From ca2b6102c508bcf78abf277035322b5c36e6bfbc Mon Sep 17 00:00:00 2001
From: youjie <272855983@qq.com>
Date: Tue, 20 Sep 2022 11:33:31 +0800
Subject: [PATCH] 优化登录界面

---
 jeecg-boot-master/ant-design-vue-jeecg/src/views/user/Login.vue                                                              |  4 ++--
 jeecg-boot-master/ant-design-vue-jeecg/src/views/user/LoginAccount.vue                                                       | 13 ++++++-------
 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java | 70 +++++++++++++++++++++++++++++++++++-----------------------------------
 3 files changed, 43 insertions(+), 44 deletions(-)

diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/user/Login.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/user/Login.vue
index c6372aa..d7949c4 100644
--- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/user/Login.vue
+++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/user/Login.vue
@@ -11,7 +11,7 @@
 <!--        </a-tab-pane>-->
       </a-tabs>
 
-      <a-form-model-item>
+<!--      <a-form-model-item>-->
 <!--        <a-checkbox @change="handleRememberMeChange" default-checked>自动登录</a-checkbox>-->
 <!--        <router-link :to="{ name: 'alteration'}" class="forge-password" style="float: right;">-->
 <!--          忘记密码-->
@@ -19,7 +19,7 @@
 <!--        <router-link :to="{ name: 'register'}" class="forge-password" style="float: right;margin-right: 10px" >-->
 <!--          注册账户-->
 <!--        </router-link>-->
-      </a-form-model-item>
+<!--      </a-form-model-item>-->
 
       <a-form-item style="margin-top:24px">
         <a-button size="large"  type="primary"  htmlType="submit"  class="login-button"  :loading="loginBtn"  @click.stop.prevent="handleSubmit" :disabled="loginBtn">确定
diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/user/LoginAccount.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/user/LoginAccount.vue
index 197513d..3871dcf 100644
--- a/jeecg-boot-master/ant-design-vue-jeecg/src/views/user/LoginAccount.vue
+++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/user/LoginAccount.vue
@@ -45,7 +45,7 @@
         model:{
           username: '',
           password: '',
-          inputCode: ''
+          // inputCode: ''
         },
         validatorRules:{
           username: [
@@ -55,9 +55,9 @@
           password: [{
             required: true, message: '请输入密码!', validator: 'click'
           }],
-          inputCode: [{
-            required: true, message: '请输入验证码!'
-          }]
+          // inputCode: [{
+          //   required: true, message: '请输入验证码!'
+          // }]
         }
 
       }
@@ -70,7 +70,7 @@
       /**刷新验证码*/
       handleChangeCheckCode(){
         this.currdatetime = new Date().getTime();
-        this.model.inputCode = ''
+        // this.model.inputCode = ''
         getAction(`/sys/randomImage/${this.currdatetime}`).then(res=>{
           if(res.success){
             this.randCodeImage = res.result
@@ -123,12 +123,11 @@
       },
       //账号密码登录
       handleLogin(rememberMe){
-        this.validateFields([ 'username', 'password', 'inputCode' ], (err)=>{
+        this.validateFields([ 'username', 'password' ], (err)=>{
           if(!err){
             let loginParams = {
               username: this.model.username,
               password: this.model.password,
-              captcha: this.model.inputCode,
               checkKey: this.currdatetime,
               remember_me: rememberMe,
             }
diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
index 67e7f0a..465db95 100644
--- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
+++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
@@ -71,22 +71,22 @@ public class LoginController {
 		//update-begin--Author:scott  Date:20190805 for:暂时注释掉密码加密逻辑,有点问题
 
 		//update-begin-author:taoyan date:20190828 for:校验验证码
-        String captcha = sysLoginModel.getCaptcha();
-        if(captcha==null){
-            result.error500("验证码无效");
-            return result;
-        }
-        String lowerCaseCaptcha = captcha.toLowerCase();
-		String realKey = MD5Util.MD5Encode(lowerCaseCaptcha+sysLoginModel.getCheckKey(), "utf-8");
-		Object checkCode = redisUtil.get(realKey);
-		//当进入登录页时,有一定几率出现验证码错误 #1714
-		if(checkCode==null || !checkCode.toString().equals(lowerCaseCaptcha)) {
-            log.warn("验证码错误,key= {} , Ui checkCode= {}, Redis checkCode = {}", sysLoginModel.getCheckKey(), lowerCaseCaptcha, checkCode);
-			result.error500("验证码错误");
-			return result;
-		}
+//        String captcha = sysLoginModel.getCaptcha();
+//        if(captcha==null){
+//            result.error500("验证码无效");
+//            return result;
+//        }
+//        String lowerCaseCaptcha = captcha.toLowerCase();
+//		String realKey = MD5Util.MD5Encode(lowerCaseCaptcha+sysLoginModel.getCheckKey(), "utf-8");
+//		Object checkCode = redisUtil.get(realKey);
+//		//当进入登录页时,有一定几率出现验证码错误 #1714
+//		if(checkCode==null || !checkCode.toString().equals(lowerCaseCaptcha)) {
+//            log.warn("验证码错误,key= {} , Ui checkCode= {}, Redis checkCode = {}", sysLoginModel.getCheckKey(), lowerCaseCaptcha, checkCode);
+//			result.error500("验证码错误");
+//			return result;
+//		}
 		//update-end-author:taoyan date:20190828 for:校验验证码
-		
+
 		//1. 校验用户是否有效
 		//update-begin-author:wangshuai date:20200601 for: 登录代码验证用户是否注销bug,if条件永远为false
 		LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
@@ -97,7 +97,7 @@ public class LoginController {
 		if(!result.isSuccess()) {
 			return result;
 		}
-		
+
 		//2. 校验用户名或密码是否正确
 		String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
 		String syspassword = sysUser.getPassword();
@@ -105,11 +105,11 @@ public class LoginController {
 			result.error500("用户名或密码错误");
 			return result;
 		}
-				
+
 		//用户登录信息
 		userInfo(sysUser, result);
 		//update-begin--Author:liusq  Date:20210126  for:登录成功,删除redis中的验证码
-		redisUtil.del(realKey);
+//		redisUtil.del(realKey);
 		//update-begin--Author:liusq  Date:20210126  for:登录成功,删除redis中的验证码
 		LoginUser loginUser = new LoginUser();
 		BeanUtils.copyProperties(sysUser, loginUser);
@@ -141,7 +141,7 @@ public class LoginController {
 		return result;
 
 	}
-	
+
 	/**
 	 * 退出登录
 	 * @param request
@@ -175,7 +175,7 @@ public class LoginController {
 	    	return Result.error("Token无效!");
 	    }
 	}
-	
+
 	/**
 	 * 获取访问量
 	 * @return
@@ -206,7 +206,7 @@ public class LoginController {
 		result.success("登录成功");
 		return result;
 	}
-	
+
 	/**
 	 * 获取访问量
 	 * @return
@@ -227,8 +227,8 @@ public class LoginController {
 		result.setResult(oConvertUtils.toLowerCasePageList(list));
 		return result;
 	}
-	
-	
+
+
 	/**
 	 * 登陆成功选择用户当前部门
 	 * @param user
@@ -253,7 +253,7 @@ public class LoginController {
 
 	/**
 	 * 短信登录接口
-	 * 
+	 *
 	 * @param jsonObject
 	 * @return
 	 */
@@ -302,7 +302,7 @@ public class LoginController {
 					}
 					return result;
 				}
-				
+
 				/**
 				 * smsmode 短信模板方式  0 .登录模板、1.注册模板、2.忘记密码模板
 				 */
@@ -334,11 +334,11 @@ public class LoginController {
 		}
 		return result;
 	}
-	
+
 
 	/**
 	 * 手机号登录接口
-	 * 
+	 *
 	 * @param jsonObject
 	 * @return
 	 */
@@ -347,14 +347,14 @@ public class LoginController {
 	public Result<JSONObject> phoneLogin(@RequestBody JSONObject jsonObject) {
 		Result<JSONObject> result = new Result<JSONObject>();
 		String phone = jsonObject.getString("mobile");
-		
+
 		//校验用户有效性
 		SysUser sysUser = sysUserService.getUserByPhone(phone);
 		result = sysUserService.checkUserIsEffective(sysUser);
 		if(!result.isSuccess()) {
 			return result;
 		}
-		
+
 		String smscode = jsonObject.getString("captcha");
 		Object code = redisUtil.get(phone);
 		if (!smscode.equals(code)) {
@@ -473,7 +473,7 @@ public class LoginController {
 		}
 		return res;
 	}
-	
+
 	/**
 	 * app登录
 	 * @param sysLoginModel
@@ -485,14 +485,14 @@ public class LoginController {
 		Result<JSONObject> result = new Result<JSONObject>();
 		String username = sysLoginModel.getUsername();
 		String password = sysLoginModel.getPassword();
-		
+
 		//1. 校验用户是否有效
 		SysUser sysUser = sysUserService.getUserByName(username);
 		result = sysUserService.checkUserIsEffective(sysUser);
 		if(!result.isSuccess()) {
 			return result;
 		}
-		
+
 		//2. 校验用户名或密码是否正确
 		String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
 		String syspassword = sysUser.getPassword();
@@ -500,7 +500,7 @@ public class LoginController {
 			result.error500("用户名或密码错误");
 			return result;
 		}
-		
+
 		String orgCode = sysUser.getOrgCode();
 		if(oConvertUtils.isEmpty(orgCode)) {
 			//如果当前用户无选择部门 查看部门关联信息
@@ -519,7 +519,7 @@ public class LoginController {
 		JSONObject obj = new JSONObject();
 		//用户登录信息
 		obj.put("userInfo", sysUser);
-		
+
 		// 生成token
 		String token = JwtUtil.sign(username, syspassword);
 		// 设置超时时间
@@ -609,4 +609,4 @@ public class LoginController {
 		return Result.OK(result);
 	}
 
-}
\ No newline at end of file
+}
--
libgit2 0.22.2