fix(#IX3JR): 修复用户名为空时触发数据库异常
#Comment comment #IX3JR #Issue close https://gitee.com/LongbowEnterprise/dashboard/issues?id=IX3JR
This commit is contained in:
parent
22b863ff24
commit
89478672bd
|
@ -19,6 +19,7 @@ namespace Bootstrap.DataAccess
|
|||
public static bool Log(LoginUser user)
|
||||
{
|
||||
if (user.Id == string.Empty) user.Id = null;
|
||||
if (string.IsNullOrEmpty(user.UserName)) user.UserName = user.Ip;
|
||||
return DbContextManager.Create<LoginUser>().Log(user);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Bootstrap.DataAccess
|
|||
Result = "登录失败"
|
||||
};
|
||||
config(loginUser);
|
||||
var ret = DbContextManager.Create<User>().Authenticate(userName, password);
|
||||
var ret = string.IsNullOrEmpty(userName) ? false : DbContextManager.Create<User>().Authenticate(userName, password);
|
||||
if (ret) loginUser.Result = "登录成功";
|
||||
LoginHelper.Log(loginUser);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue