]> Untitled Git - lemmy.git/commitdiff
Don't check verified email when an admin logs in (#3209)
authorkartikynwa <kartik.ynwa@gmail.com>
Tue, 20 Jun 2023 12:52:21 +0000 (18:22 +0530)
committerGitHub <noreply@github.com>
Tue, 20 Jun 2023 12:52:21 +0000 (08:52 -0400)
Workaround for instance admins getting locked out when they turn on
the email verification requirement without having verified their
own email.

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
crates/api/src/local_user/login.rs

index 9f5e587443b40495740f88b7e8b23ef136bfa0de..9e211c9c44dfe589a6062417fb5ce515b6182924 100644 (file)
@@ -40,7 +40,11 @@ impl Perform for Login {
       local_user_view.person.deleted,
     )?;
 
       local_user_view.person.deleted,
     )?;
 
-    if site_view.local_site.require_email_verification && !local_user_view.local_user.email_verified
+    // Check if the user's email is verified if email verification is turned on
+    // However, skip checking verification if the user is an admin
+    if !local_user_view.person.admin
+      && site_view.local_site.require_email_verification
+      && !local_user_view.local_user.email_verified
     {
       return Err(LemmyError::from_message("email_not_verified"));
     }
     {
       return Err(LemmyError::from_message("email_not_verified"));
     }