Fixing error when email already exists. Fixes #427
This commit is contained in:
parent
fb82a489d5
commit
05f2bfc83c
5 changed files with 34 additions and 13 deletions
18
README.md
vendored
18
README.md
vendored
|
@ -151,15 +151,15 @@ If you'd like to add translations, take a look a look at the [English translatio
|
||||||
|
|
||||||
lang | done | missing
|
lang | done | missing
|
||||||
--- | --- | ---
|
--- | --- | ---
|
||||||
de | 95% | avatar,upload_avatar,show_avatars,docs,old_password,send_notifications_to_email,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw
|
de | 94% | avatar,upload_avatar,show_avatars,docs,old_password,send_notifications_to_email,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw,email_already_exists
|
||||||
eo | 82% | number_of_communities,preview,upload_image,avatar,upload_avatar,show_avatars,formatting_help,view_source,sticky,unsticky,archive_link,stickied,delete_account,delete_account_confirm,banned,creator,number_online,docs,replies,mentions,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw,theme,are_you_sure,yes,no
|
eo | 81% | number_of_communities,preview,upload_image,avatar,upload_avatar,show_avatars,formatting_help,view_source,sticky,unsticky,archive_link,stickied,delete_account,delete_account_confirm,banned,creator,number_online,docs,replies,mentions,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw,theme,are_you_sure,yes,no,email_already_exists
|
||||||
es | 90% | avatar,upload_avatar,show_avatars,archive_link,docs,replies,mentions,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw
|
es | 89% | avatar,upload_avatar,show_avatars,archive_link,docs,replies,mentions,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw,email_already_exists
|
||||||
fr | 90% | avatar,upload_avatar,show_avatars,archive_link,docs,replies,mentions,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw
|
fr | 89% | avatar,upload_avatar,show_avatars,archive_link,docs,replies,mentions,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw,email_already_exists
|
||||||
it | 91% | avatar,upload_avatar,show_avatars,archive_link,docs,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw
|
it | 90% | avatar,upload_avatar,show_avatars,archive_link,docs,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw,email_already_exists
|
||||||
nl | 100% |
|
nl | 100% | email_already_exists
|
||||||
ru | 78% | cross_posts,cross_post,number_of_communities,preview,upload_image,avatar,upload_avatar,show_avatars,formatting_help,view_source,sticky,unsticky,archive_link,stickied,delete_account,delete_account_confirm,banned,creator,number_online,docs,replies,mentions,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw,recent_comments,theme,monero,by,to,transfer_community,transfer_site,are_you_sure,yes,no
|
ru | 77% | cross_posts,cross_post,number_of_communities,preview,upload_image,avatar,upload_avatar,show_avatars,formatting_help,view_source,sticky,unsticky,archive_link,stickied,delete_account,delete_account_confirm,banned,creator,number_online,docs,replies,mentions,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw,recent_comments,theme,monero,by,to,transfer_community,transfer_site,are_you_sure,yes,no,email_already_exists
|
||||||
sv | 90% | avatar,upload_avatar,show_avatars,archive_link,docs,replies,mentions,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw
|
sv | 89% | avatar,upload_avatar,show_avatars,archive_link,docs,replies,mentions,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw,email_already_exists
|
||||||
zh | 76% | cross_posts,cross_post,users,number_of_communities,preview,upload_image,avatar,upload_avatar,show_avatars,formatting_help,view_source,sticky,unsticky,archive_link,settings,stickied,delete_account,delete_account_confirm,banned,creator,number_online,docs,replies,mentions,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw,recent_comments,nsfw,show_nsfw,theme,monero,by,to,transfer_community,transfer_site,are_you_sure,yes,no
|
zh | 75% | cross_posts,cross_post,users,number_of_communities,preview,upload_image,avatar,upload_avatar,show_avatars,formatting_help,view_source,sticky,unsticky,archive_link,settings,stickied,delete_account,delete_account_confirm,banned,creator,number_online,docs,replies,mentions,old_password,forgot_password,reset_password_mail_sent,password_change,new_password,no_email_setup,send_notifications_to_email,language,browser_default,downvotes_disabled,enable_downvotes,open_registration,registration_closed,enable_nsfw,recent_comments,nsfw,show_nsfw,theme,monero,by,to,transfer_community,transfer_site,are_you_sure,yes,no,email_already_exists
|
||||||
|
|
||||||
|
|
||||||
If you'd like to update this report, run:
|
If you'd like to update this report, run:
|
||||||
|
|
2
docker/lemmy.hjson
vendored
2
docker/lemmy.hjson
vendored
|
@ -14,7 +14,7 @@
|
||||||
pool_size: 5
|
pool_size: 5
|
||||||
}
|
}
|
||||||
# the domain name of your instance (eg "dev.lemmy.ml")
|
# the domain name of your instance (eg "dev.lemmy.ml")
|
||||||
hostname: "rrr"
|
hostname: "my_domain"
|
||||||
# address where lemmy should listen for incoming requests
|
# address where lemmy should listen for incoming requests
|
||||||
bind: "0.0.0.0"
|
bind: "0.0.0.0"
|
||||||
# port where lemmy should listen for incoming requests
|
# port where lemmy should listen for incoming requests
|
||||||
|
|
2
server/config/defaults.hjson
vendored
2
server/config/defaults.hjson
vendored
|
@ -15,7 +15,7 @@
|
||||||
pool_size: 5
|
pool_size: 5
|
||||||
}
|
}
|
||||||
# the domain name of your instance (eg "dev.lemmy.ml")
|
# the domain name of your instance (eg "dev.lemmy.ml")
|
||||||
hostname: "rrr"
|
hostname: "my_domain"
|
||||||
# address where lemmy should listen for incoming requests
|
# address where lemmy should listen for incoming requests
|
||||||
bind: "0.0.0.0"
|
bind: "0.0.0.0"
|
||||||
# port where lemmy should listen for incoming requests
|
# port where lemmy should listen for incoming requests
|
||||||
|
|
|
@ -239,7 +239,17 @@ impl Perform<LoginResponse> for Oper<Register> {
|
||||||
// Create the user
|
// Create the user
|
||||||
let inserted_user = match User_::register(&conn, &user_form) {
|
let inserted_user = match User_::register(&conn, &user_form) {
|
||||||
Ok(user) => user,
|
Ok(user) => user,
|
||||||
Err(_e) => return Err(APIError::err(&self.op, "user_already_exists").into()),
|
Err(e) => {
|
||||||
|
let err_type = if e.to_string()
|
||||||
|
== "duplicate key value violates unique constraint \"user__email_key\""
|
||||||
|
{
|
||||||
|
"email_already_exists"
|
||||||
|
} else {
|
||||||
|
"user_already_exists"
|
||||||
|
};
|
||||||
|
|
||||||
|
return Err(APIError::err(&self.op, err_type).into());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the main community if it doesn't exist
|
// Create the main community if it doesn't exist
|
||||||
|
@ -364,7 +374,17 @@ impl Perform<LoginResponse> for Oper<SaveUserSettings> {
|
||||||
|
|
||||||
let updated_user = match User_::update(&conn, user_id, &user_form) {
|
let updated_user = match User_::update(&conn, user_id, &user_form) {
|
||||||
Ok(user) => user,
|
Ok(user) => user,
|
||||||
Err(_e) => return Err(APIError::err(&self.op, "couldnt_update_user").into()),
|
Err(e) => {
|
||||||
|
let err_type = if e.to_string()
|
||||||
|
== "duplicate key value violates unique constraint \"user__email_key\""
|
||||||
|
{
|
||||||
|
"email_already_exists"
|
||||||
|
} else {
|
||||||
|
"user_already_exists"
|
||||||
|
};
|
||||||
|
|
||||||
|
return Err(APIError::err(&self.op, err_type).into());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return the jwt
|
// Return the jwt
|
||||||
|
|
1
ui/src/translations/en.ts
vendored
1
ui/src/translations/en.ts
vendored
|
@ -210,6 +210,7 @@ export const en = {
|
||||||
passwords_dont_match: 'Passwords do not match.',
|
passwords_dont_match: 'Passwords do not match.',
|
||||||
admin_already_created: "Sorry, there's already an admin.",
|
admin_already_created: "Sorry, there's already an admin.",
|
||||||
user_already_exists: 'User already exists.',
|
user_already_exists: 'User already exists.',
|
||||||
|
email_already_exists: 'Email already exists.',
|
||||||
couldnt_update_user: "Couldn't update user.",
|
couldnt_update_user: "Couldn't update user.",
|
||||||
system_err_login: 'System error. Try logging out and back in.',
|
system_err_login: 'System error. Try logging out and back in.',
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue