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

Correct error messages if user registers with taken user/email #3093

Merged
merged 3 commits into from
Jun 21, 2023

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented Jun 14, 2023

Fixes #2955

@Nutomic Nutomic requested a review from dessalines as a code owner June 14, 2023 13:38
@Nutomic Nutomic force-pushed the duplicate-signup-errors branch 4 times, most recently from 71c5bf1 to 01a352a Compare June 15, 2023 09:35
@@ -111,28 +118,12 @@ impl PerformCrud for Register {
let local_user_form = LocalUserInsertForm::builder()
.person_id(inserted_person.id)
.email(data.email.as_deref().map(str::to_lowercase))
.password_encrypted(data.password.to_string())
.password_encrypted(hash(&data.password, DEFAULT_COST)?)
Copy link
Member

Choose a reason for hiding this comment

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

Seems fine to move this up, but I hope you tested.

Copy link
Member Author

Choose a reason for hiding this comment

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

yep

Copy link
Member Author

Choose a reason for hiding this comment

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

This wasnt working after all, because it also needs to hash the setup password defined in config file. Reverted the change.

pub async fn is_email_taken(pool: &DbPool, email_: &str) -> Result<bool, Error> {
let conn = &mut get_conn(pool).await?;
let count = local_user
.filter(email.eq(email_))
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@Nutomic Nutomic force-pushed the duplicate-signup-errors branch 2 times, most recently from 71a3824 to a1ce1f2 Compare June 20, 2023 11:07
@dessalines dessalines merged commit e3eda68 into main Jun 21, 2023
1 of 2 checks passed
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.

Error when creating a user with a non-unique name.
2 participants