From 1819c4b59b81ba4db2a38d3b3dc81f29102fde51 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Mon, 17 Apr 2023 12:36:50 -0400 Subject: 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 Co-authored-by: John Olheiser --- services/auth/source/db/authenticate.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'services/auth/source') 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 } -- cgit v1.2.3