打入补丁:88A780671C3EB0DE.patch

pull/7939/head
宋子桓🌈 2025-03-28 01:38:24 +08:00
parent 8deaeaf3f7
commit ea7fab180d
No known key found for this signature in database
GPG Key ID: BEF31CC2410A2E8A
2 changed files with 5 additions and 4 deletions

View File

@ -66,8 +66,9 @@ func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount,
// Check standard error format first, then fallback to the worse case.
tperr, ok := err.(*textproto.Error)
if (ok && tperr.Code == 535) ||
strings.Contains(err.Error(), "Username and Password not accepted") {
if (ok && (tperr.Code == 526 || tperr.Code == 530 || tperr.Code == 534 || tperr.Code == 535 || tperr.Code == 536)) ||
strings.Contains(err.Error(), "Username and Password not accepted") ||
strings.Contains(err.Error(), "Authentication failure") {
return nil, auth.ErrBadCredentials{Args: map[string]any{"login": login}}
}
return nil, err

View File

@ -171,9 +171,9 @@ func LoginPost(c *context.Context, f form.SignIn) {
case database.IsErrLoginSourceMismatch(err):
c.FormErr("LoginSource")
c.RenderWithErr(c.Tr("form.auth_source_mismatch"), LOGIN, &f)
default:
c.Error(err, "authenticate user")
c.FormErr("UserName", "Password", "LoginSource")
c.RenderWithErr(err.Error(), LOGIN, &f)
}
for i := range loginSources {
if loginSources[i].IsDefault {