mirror of
https://github.com/go-gitea/gitea
synced 2024-06-03 03:46:51 +02:00
add support for aliyun mail when authentication failed
This commit is contained in:
parent
814ca03be8
commit
280861f31e
|
@ -211,11 +211,6 @@ func SignInPost(ctx *context.Context) {
|
||||||
log.Info("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
|
log.Info("Failed authentication attempt for %s from %s: %v", form.UserName, ctx.RemoteAddr(), err)
|
||||||
ctx.Data["Title"] = ctx.Tr("auth.prohibit_login")
|
ctx.Data["Title"] = ctx.Tr("auth.prohibit_login")
|
||||||
ctx.HTML(http.StatusOK, "user/auth/prohibit_login")
|
ctx.HTML(http.StatusOK, "user/auth/prohibit_login")
|
||||||
} else if errors.As(err, &textprotoErr) {
|
|
||||||
ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), tplSignIn, &form)
|
|
||||||
log.Info("Failed authentication attempt for %s from %s (code: %d, msg: %s)", form.UserName, ctx.RemoteAddr(),
|
|
||||||
textprotoErr.Code, textprotoErr.Msg,
|
|
||||||
)
|
|
||||||
} else if user_model.IsErrUserInactive(err) {
|
} else if user_model.IsErrUserInactive(err) {
|
||||||
if setting.Service.RegisterEmailConfirm {
|
if setting.Service.RegisterEmailConfirm {
|
||||||
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
|
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
|
||||||
|
|
|
@ -52,6 +52,10 @@ func (source *Source) Authenticate(ctx context.Context, user *user_model.User, u
|
||||||
strings.Contains(err.Error(), "Application-specific password required") {
|
strings.Contains(err.Error(), "Application-specific password required") {
|
||||||
return nil, user_model.ErrUserNotExist{Name: userName}
|
return nil, user_model.ErrUserNotExist{Name: userName}
|
||||||
}
|
}
|
||||||
|
if (ok && tperr.Code == 526) ||
|
||||||
|
strings.Contains(err.Error(), "Authentication failure") {
|
||||||
|
return nil, user_model.ErrUserNotExist{Name: userName}
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user