Login error messages fix (#3525)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
59d5ae40ab
Коммит
2e513c8fd4
10
api/user.go
10
api/user.go
@@ -449,8 +449,8 @@ func login(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
if result := <-Srv.Store.User().Get(id); result.Err != nil {
|
if result := <-Srv.Store.User().Get(id); result.Err != nil {
|
||||||
c.LogAuditWithUserId(user.Id, "failure")
|
c.LogAuditWithUserId(user.Id, "failure")
|
||||||
c.Err = result.Err
|
//c.Err = model.NewLocAppError("login", "api.user.login.invalid_credentials", nil, result.Err.Error())
|
||||||
c.Err.StatusCode = http.StatusBadRequest
|
c.Err = model.NewLocAppError("login", "api.user.login.invalid_credentials", nil, "")
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
user = result.Data.(*model.User)
|
user = result.Data.(*model.User)
|
||||||
@@ -460,7 +460,8 @@ func login(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
if user, err = getUserForLogin(loginId, ldapOnly); err != nil {
|
if user, err = getUserForLogin(loginId, ldapOnly); err != nil {
|
||||||
c.LogAudit("failure")
|
c.LogAudit("failure")
|
||||||
c.Err = err
|
//c.Err = model.NewLocAppError("login", "api.user.login.invalid_credentials", nil, err.Error())
|
||||||
|
c.Err = model.NewLocAppError("login", "api.user.login.invalid_credentials", nil, "")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,7 +471,8 @@ func login(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
// and then authenticate them
|
// and then authenticate them
|
||||||
if user, err = authenticateUser(user, password, mfaToken); err != nil {
|
if user, err = authenticateUser(user, password, mfaToken); err != nil {
|
||||||
c.LogAuditWithUserId(user.Id, "failure")
|
c.LogAuditWithUserId(user.Id, "failure")
|
||||||
c.Err = err
|
//c.Err = model.NewLocAppError("login", "api.user.login.invalid_credentials", nil, err.Error())
|
||||||
|
c.Err = model.NewLocAppError("login", "api.user.login.invalid_credentials", nil, "")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1771,6 +1771,10 @@
|
|||||||
"id": "api.user.login.blank_pwd.app_error",
|
"id": "api.user.login.blank_pwd.app_error",
|
||||||
"translation": "Password field must not be blank"
|
"translation": "Password field must not be blank"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "api.user.login.invalid_credentials",
|
||||||
|
"translation": "User ID or password incorrect."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "api.user.login.inactive.app_error",
|
"id": "api.user.login.inactive.app_error",
|
||||||
"translation": "Login failed because your account has been set to inactive. Please contact an administrator."
|
"translation": "Login failed because your account has been set to inactive. Please contact an administrator."
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user