allow admin email login with restricted names #964
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user