diff options
author | techknowlogick <techknowlogick@gitea.io> | 2023-04-17 12:36:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 12:36:50 -0400 |
commit | 1819c4b59b81ba4db2a38d3b3dc81f29102fde51 (patch) | |
tree | 88ef0a294b4a92cc741c88f7207a5b7ef26ba031 /services/auth/source/db/authenticate.go | |
parent | f20057271def2240474d64c57eeba8b365642c08 (diff) | |
download | gitea-1819c4b59b81ba4db2a38d3b3dc81f29102fde51.tar.gz gitea-1819c4b59b81ba4db2a38d3b3dc81f29102fde51.zip |
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>
Diffstat (limited to 'services/auth/source/db/authenticate.go')
-rw-r--r-- | services/auth/source/db/authenticate.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/services/auth/source/db/authenticate.go b/services/auth/source/db/authenticate.go index ec89984499..76445e0d6d 100644 --- a/services/auth/source/db/authenticate.go +++ b/services/auth/source/db/authenticate.go @@ -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 } |