Skip to content

Commit 280861f

Browse files
committed
add support for aliyun mail when authentication failed
1 parent 814ca03 commit 280861f

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

routers/web/auth/auth.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,6 @@ func SignInPost(ctx *context.Context) {
211211
log.Info("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
212212
ctx.Data["Title"] = ctx.Tr("auth.prohibit_login")
213213
ctx.HTML(http.StatusOK, "user/auth/prohibit_login")
214-
} else if errors.As(err, &textprotoErr) {
215-
ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), tplSignIn, &form)
216-
log.Info("Failed authentication attempt for %s from %s (code: %d, msg: %s)", form.UserName, ctx.RemoteAddr(),
217-
textprotoErr.Code, textprotoErr.Msg,
218-
)
219214
} else if user_model.IsErrUserInactive(err) {
220215
if setting.Service.RegisterEmailConfirm {
221216
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")

services/auth/source/smtp/source_authenticate.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ func (source *Source) Authenticate(ctx context.Context, user *user_model.User, u
5252
strings.Contains(err.Error(), "Application-specific password required") {
5353
return nil, user_model.ErrUserNotExist{Name: userName}
5454
}
55+
if (ok && tperr.Code == 526) ||
56+
strings.Contains(err.Error(), "Authentication failure") {
57+
return nil, user_model.ErrUserNotExist{Name: userName}
58+
}
5559
return nil, err
5660
}
5761

0 commit comments

Comments
 (0)