mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 10:05:41 +00:00
feat: implement user registration for postgres via sqlx
This commit is contained in:
@@ -26,8 +26,13 @@ pub fn map_register_err(e: Error) -> DBError {
|
||||
if let Error::Database(err) = e {
|
||||
if err.code() == Some(Cow::from("23505")) {
|
||||
let msg = err.message();
|
||||
if msg.contains("mcaptcha_users_username_key") {
|
||||
unimplemented!();
|
||||
println!("{}", msg);
|
||||
if msg.contains("mcaptcha_users_name_key") {
|
||||
DBError::UsernameTaken
|
||||
} else if msg.contains("mcaptcha_users_email_key") {
|
||||
DBError::EmailTaken
|
||||
} else if msg.contains("mcaptcha_users_secret_key") {
|
||||
DBError::SecretTaken
|
||||
} else {
|
||||
DBError::DBError(Box::new(Error::Database(err)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user