From: kartikynwa Date: Tue, 20 Jun 2023 12:52:21 +0000 (+0530) Subject: Don't check verified email when an admin logs in (#3209) X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%22https:/nerdica.net/readmes/sneer-club-logo.svg?a=commitdiff_plain;h=dc36d9ed899fb5567c25b2eb103b4429a071413f;p=lemmy.git Don't check verified email when an admin logs in (#3209) 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 --- diff --git a/crates/api/src/local_user/login.rs b/crates/api/src/local_user/login.rs index 9f5e5874..9e211c9c 100644 --- a/crates/api/src/local_user/login.rs +++ b/crates/api/src/local_user/login.rs @@ -40,7 +40,11 @@ impl Perform for Login { 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")); }