登录检查user空的情况
This commit is contained in:
@@ -90,7 +90,7 @@ func LoginFromOMC(w http.ResponseWriter, r *http.Request) {
|
|||||||
*/
|
*/
|
||||||
validUser, user, err := dborm.XormCheckLoginUser(oAuthBody.UserName,
|
validUser, user, err := dborm.XormCheckLoginUser(oAuthBody.UserName,
|
||||||
oAuthBody.Value, config.GetYamlConfig().Auth.Crypt)
|
oAuthBody.Value, config.GetYamlConfig().Auth.Crypt)
|
||||||
if !validUser && err != nil {
|
if !validUser || err != nil {
|
||||||
// response 400-4
|
// response 400-4
|
||||||
log.Error("Authentication failed, mismatch user or password")
|
log.Error("Authentication failed, mismatch user or password")
|
||||||
services.ResponseErrorWithJson(w, 400, err.Error())
|
services.ResponseErrorWithJson(w, 400, err.Error())
|
||||||
@@ -112,6 +112,7 @@ func LoginFromOMC(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if user != nil {
|
||||||
// 缓存用户信息
|
// 缓存用户信息
|
||||||
account.CacheLoginUser(user)
|
account.CacheLoginUser(user)
|
||||||
// 角色权限集合,管理员拥有所有权限
|
// 角色权限集合,管理员拥有所有权限
|
||||||
@@ -119,6 +120,9 @@ func LoginFromOMC(w http.ResponseWriter, r *http.Request) {
|
|||||||
isAdmin := conf.IsAdmin(userId)
|
isAdmin := conf.IsAdmin(userId)
|
||||||
roles, perms := service.NewServiceAccount.RoleAndMenuPerms(userId, isAdmin)
|
roles, perms := service.NewServiceAccount.RoleAndMenuPerms(userId, isAdmin)
|
||||||
services.ResponseStatusOK200LoginWhitRP(w, token, user, roles, perms)
|
services.ResponseStatusOK200LoginWhitRP(w, token, user, roles, perms)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
services.ResponseBadRequest400IncorrectLogin(w)
|
||||||
}
|
}
|
||||||
|
|
||||||
func LogoutFromOMC(w http.ResponseWriter, r *http.Request) {
|
func LogoutFromOMC(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
Reference in New Issue
Block a user