dupe email check and notifications table

This commit is contained in:
realaravinth
2021-07-13 21:23:08 +05:30
parent 47cca5c9a7
commit 558dbef712
5 changed files with 51 additions and 34 deletions

View File

@@ -182,7 +182,7 @@ pub mod runners {
if msg.contains("mcaptcha_users_name_key") {
return Err(ServiceError::UsernameTaken);
} else if msg.contains("mcaptcha_users_email_key") {
return Err(ServiceError::UsernameTaken);
return Err(ServiceError::EmailTaken);
} else if msg.contains("mcaptcha_users_secret_key") {
continue;
} else {

View File

@@ -59,7 +59,7 @@ async fn auth_works() {
signin(EMAIL, PASSWORD).await;
// 2. check if duplicate username is allowed
let msg = Register {
let mut msg = Register {
username: NAME.into(),
password: PASSWORD.into(),
confirm_password: PASSWORD.into(),
@@ -75,6 +75,18 @@ async fn auth_works() {
)
.await;
let name = format!("{}dupemail", NAME);
msg.username = name;
bad_post_req_test(
NAME,
PASSWORD,
ROUTES.auth.register,
&msg,
ServiceError::EmailTaken,
StatusCode::BAD_REQUEST,
)
.await;
// 3. sigining in with non-existent user
let mut creds = Login {
login: "nonexistantuser".into(),