Fix panic in func (c *ApiController) GetUser() if no user exists in DB

This commit is contained in:
Yang Luo
2023-07-14 20:57:59 +08:00
parent 854a74b73e
commit 19ab168b12
2 changed files with 9 additions and 4 deletions

View File

@ -198,7 +198,10 @@ func (c *ApiController) GetUser() {
return
}
user.MultiFactorAuths = object.GetAllMfaProps(user, true)
if user != nil {
user.MultiFactorAuths = object.GetAllMfaProps(user, true)
}
err = object.ExtendUserWithRolesAndPermissions(user)
if err != nil {
c.ResponseError(err.Error())