@@ -22,6 +22,8 @@ pub enum ServiceError {
22
22
23
23
#[ display( "Email is required" ) ] //405j
24
24
EmailMissing ,
25
+ #[ display( "A verified email is required" ) ]
26
+ VerifiedEmailMissing ,
25
27
#[ display( "Please enter a valid email address" ) ] //405j
26
28
EmailInvalid ,
27
29
@@ -60,6 +62,9 @@ pub enum ServiceError {
60
62
#[ display( "Passwords don't match" ) ]
61
63
PasswordsDontMatch ,
62
64
65
+ #[ display( "Couldn't send new password to the user" ) ]
66
+ FailedToSendResetPassword ,
67
+
63
68
/// when the a username is already taken
64
69
#[ display( "Username not available" ) ]
65
70
UsernameTaken ,
@@ -288,6 +293,7 @@ pub fn http_status_code_for_service_error(error: &ServiceError) -> StatusCode {
288
293
ServiceError :: PasswordTooShort => StatusCode :: BAD_REQUEST ,
289
294
ServiceError :: PasswordTooLong => StatusCode :: BAD_REQUEST ,
290
295
ServiceError :: PasswordsDontMatch => StatusCode :: BAD_REQUEST ,
296
+ ServiceError :: FailedToSendResetPassword => StatusCode :: INTERNAL_SERVER_ERROR ,
291
297
ServiceError :: UsernameTaken => StatusCode :: BAD_REQUEST ,
292
298
ServiceError :: UsernameInvalid => StatusCode :: BAD_REQUEST ,
293
299
ServiceError :: EmailTaken => StatusCode :: BAD_REQUEST ,
@@ -316,6 +322,7 @@ pub fn http_status_code_for_service_error(error: &ServiceError) -> StatusCode {
316
322
ServiceError :: TagAlreadyExists => StatusCode :: BAD_REQUEST ,
317
323
ServiceError :: InternalServerError => StatusCode :: INTERNAL_SERVER_ERROR ,
318
324
ServiceError :: EmailMissing => StatusCode :: NOT_FOUND ,
325
+ ServiceError :: VerifiedEmailMissing => StatusCode :: NOT_FOUND ,
319
326
ServiceError :: FailedToSendVerificationEmail => StatusCode :: INTERNAL_SERVER_ERROR ,
320
327
ServiceError :: WhitelistingError => StatusCode :: INTERNAL_SERVER_ERROR ,
321
328
ServiceError :: DatabaseError => StatusCode :: INTERNAL_SERVER_ERROR ,
0 commit comments