diff --git a/backend/app/cmd/server.go b/backend/app/cmd/server.go index 2a7899e1..ba1c2f07 100644 --- a/backend/app/cmd/server.go +++ b/backend/app/cmd/server.go @@ -932,8 +932,9 @@ func (s *ServerCommand) makeAuthenticator(ds *service.DataStore, avas avatar.Sto log.Printf("[WARN] can't read email for %s, %v", c.User.ID, err) } - // don't allow anonymous and email with admin's name - if strings.HasPrefix(c.User.ID, "anonymous_") || strings.HasPrefix(c.User.ID, "email_") { + // don't allow anonymous and email with admins names + // exclude admin from impersonation detection over email, it prevents a valid admin to login with RestrictedNames + if strings.HasPrefix(c.User.ID, "anonymous_") || (strings.HasPrefix(c.User.ID, "email_") && !c.User.IsAdmin()) { for _, a := range s.RestrictedNames { if strings.EqualFold(strings.TrimSpace(c.User.Name), a) { c.User.SetBoolAttr("blocked", true)