Commit 62957687 by chent

修改登录报错问题

parent 625a7a20
...@@ -35,13 +35,18 @@ public class UserServiceImpl implements UserService { ...@@ -35,13 +35,18 @@ public class UserServiceImpl implements UserService {
public XzxtRestResult login(String username, String password) { public XzxtRestResult login(String username, String password) {
//XzxtRestResult xzxtRestResult=new XzxtRestResult(); //XzxtRestResult xzxtRestResult=new XzxtRestResult();
User user=userMapper.login(username); User user=userMapper.login(username);
if (user.getPassword().equals(password)&&user.getStatus() == 0) { if(user==null){
// 因为缓存切面的原因,在这里就抛出用户名不存在的异常 return XzxtRestResult.build(202,"用户不存在");
return XzxtRestResult.build(201,"登陆成功"); }else{
} if (user.getPassword().equals(password)&&user.getStatus() == 0) {
else { // 因为缓存切面的原因,在这里就抛出用户名不存在的异常
return XzxtRestResult.build(202,"登陆密码错误或者用户被锁定"); return XzxtRestResult.build(201,"登陆成功");
}
else {
return XzxtRestResult.build(202,"登陆密码错误或者用户被锁定");
}
} }
} }
@Override @Override
public ResultMap userAll(User user) { public ResultMap userAll(User user) {
......
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label login-form"><i class="iconfont">&#xe82b;</i></label> <label class="layui-form-label login-form"><i class="iconfont">&#xe82b;</i></label>
<div class="layui-input-inline login-inline"> <div class="layui-input-inline login-inline">
<input type="text" name="password" lay-verify="required" placeholder="请输入你的密码" autocomplete="off" class="layui-input"> <input type="password" name="password" lay-verify="required" placeholder="请输入你的密码" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="form-actions"> <div class="form-actions">
<button class="btn btn-warning pull-right" lay-submit lay-filter="login" type="submit">登录</button> <button class="btn btn-warning pull-right" lay-submit lay-filter="login" type="submit">登录</button>
<div class="forgot"><a href="#" class="forgot">忘记帐号或者密码</a></div> <div class="forgot"><a href="#" class="forgot">忘记帐号或者密码</a></div>
</div> </div>
</form> </form>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment