Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double phone vote #36

Merged

Conversation

Stef-Rousset
Copy link
Contributor

Problem:
If i create an account with no phone number, I can the vote and enter a phone number that already belongs to another account, and vote twice with the same phone number

Related Issues:
Notion card => https://www.notion.so/opensourcepolitics/bd4bf860eab94f9daca7da803f09e3b2?v=c96df65755dd403d95e86f82d7749709&p=39467ef809e94526bf88fee4516f89f3&pm=c

Testing:

  1. As a user, create an account with email
  2. As user, go to Assemblies > choose one assembly > go to budgets > choose one budget > vote by providing a phone number
  3. As a second user, create an account with email
  4. As a second user, go to Assemblies > choose one assembly > go to budgets > choose one budget > vote by providing the same phone number/phone country provided by first user
  5. Notice that you have a message that indicates phone number is not available and you must provide another number

If you have time, you can also check that those paths still work well:

  1. As a user not signed in, vote with only your phone number (anonymous user)
  2. As a user not signed in, vote with only your phone number by providing the same phone number already linked to an account and note that you are signed in and not anonymous user anymore

Tasks:
Add specs

@Stef-Rousset Stef-Rousset marked this pull request as ready for review June 11, 2024 13:05
Copy link

@BarbaraOliveira13 BarbaraOliveira13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran it, works 🎉

Copy link
Contributor

@Quentinchampenois Quentinchampenois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, just a change request

@@ -13,6 +13,8 @@ def call
return broadcast(:invalid) unless @form.valid?

if @form.auth_method == "sms"
return broadcast(:invalid, "non disponible") if registered_user_with_same_phone_and_country?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return broadcast(:invalid, "non disponible") if registered_user_with_same_phone_and_country?
return broadcast(:invalid, :already_exist) if registered_user_with_same_phone_and_country?

Prefer to use symbol rather than french translation

@@ -41,7 +41,9 @@ def verification
end

on(:invalid) do |error_code|
flash.now[:alert] = if error_code
flash.now[:alert] = if error_code == "non disponible"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
flash.now[:alert] = if error_code == "non disponible"
flash.now[:alert] = if error_code == :already_exist

@Quentinchampenois Quentinchampenois merged commit ff58323 into feature/half_signup_and_budgets_booth Jun 19, 2024
6 checks passed
@Quentinchampenois Quentinchampenois deleted the fix/double_phone_vote branch June 19, 2024 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants