forked from forgejo/forgejo
Add new user types reserved
, bot
, and remote
(#24026)
This allows for usernames, and emails connected to them to be reserved and not reused. Use case, I manage an instance with open registration, and sometimes when users are deleted for spam (or other purposes), their usernames are freed up and they sign up again with the same information. This could also be used to reserve usernames, and block them from being registered (in case an instance would like to block certain things without hardcoding the list in code and compiling from scratch). This is an MVP, that will allow for future work where you can set something as reserved via the interface. --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
f20057271d
commit
1819c4b59b
2 changed files with 23 additions and 1 deletions
|
@ -40,5 +40,13 @@ func Authenticate(user *user_model.User, login, password string) (*user_model.Us
|
|||
}
|
||||
}
|
||||
|
||||
// attempting to login as a non-user account
|
||||
if user.Type != user_model.UserTypeIndividual {
|
||||
return nil, user_model.ErrUserProhibitLogin{
|
||||
UID: user.ID,
|
||||
Name: user.Name,
|
||||
}
|
||||
}
|
||||
|
||||
return user, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue