mirror of
https://github.com/mattermost/mattermost.git
synced 2026-11-01 09:28:09 -06:00
drip: AppError -> error: bot login check
Co-authored-by: jesse <jesse@mattermost.com>
This commit is contained in:
2 files changed
+4
-4
No files matched your search
@@ -340,7 +340,7 @@ func (a *App) CheckUserPreflightAuthenticationCriteria(rctx request.CTX, user *m
|
||||
}
|
||||
|
||||
if err := checkUserNotBot(user); err != nil {
|
||||
return err
|
||||
return model.AsAppError(err)
|
||||
}
|
||||
|
||||
if err := checkUserLoginAttempts(user, *a.Config().ServiceSettings.MaximumLoginAttempts); err != nil {
|
||||
@@ -446,7 +446,7 @@ func checkUserNotDisabled(user *model.User) *model.AppError {
|
||||
return nil
|
||||
}
|
||||
|
||||
func checkUserNotBot(user *model.User) *model.AppError {
|
||||
func checkUserNotBot(user *model.User) error {
|
||||
if user.IsBot {
|
||||
return model.NewAppError("Login", "api.user.login.bot_login_forbidden.app_error", nil, "user_id="+user.Id, http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ func (a *App) AuthenticateUserForLogin(rctx request.CTX, id, loginId, password,
|
||||
if err = checkUserNotDisabled(user); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = checkUserNotBot(user); err != nil {
|
||||
return nil, err
|
||||
if err := checkUserNotBot(user); err != nil {
|
||||
return nil, model.AsAppError(err)
|
||||
}
|
||||
if user.LastLogin > 0 {
|
||||
return nil, model.NewAppError("AuthenticateUserForLogin",
|
||||
|
||||
Reference in new issue
Block a user