Ver Fonte

fix 新增明文密码,只在小程序登录使用

Administrator há 1 ano atrás
pai
commit
380fee7e66

+ 2 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -142,6 +142,7 @@ public class SysUserController extends BaseController
             return AjaxResult.error("密码必须包含数字、大小写字母、特殊符号且大于8位");
         }
         user.setCreateBy(getUsername());
+        user.setPasswordMw(user.getPassword());
         user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
         return toAjax(userService.insertUser(user));
     }
@@ -200,6 +201,7 @@ public class SysUserController extends BaseController
         }
         //userService.checkUserAllowed(user);
         userService.checkUserDataScope(user.getUserId());
+        user.setPasswordMw(user.getPassword());
         user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
         user.setUpdateBy(getUsername());
         return toAjax(userService.resetPwd(user));

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wx/WxPayController.java

@@ -72,7 +72,7 @@ public class WxPayController extends BaseController {
         SysUser user = userService.getByPhone(phoneNumber);
         if (user != null) {
             // 生成令牌
-            String token = loginService.loginMiniPrograms(user.getUserName(), user.getPassword());
+            String token = loginService.loginMiniPrograms(user.getUserName(), user.getPasswordMw());
             ajax.put(Constants.TOKEN, token);
         }
         return ajax;

+ 9 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java

@@ -54,6 +54,7 @@ public class SysUser extends BaseEntity
 
     /** 密码 */
     private String password;
+    private String passwordMw;
 
     /** 帐号状态(0正常 1停用) */
     @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
@@ -89,6 +90,14 @@ public class SysUser extends BaseEntity
     /** 角色ID */
     private Long roleId;
 
+    public String getPasswordMw() {
+        return passwordMw;
+    }
+
+    public void setPasswordMw(String passwordMw) {
+        this.passwordMw = passwordMw;
+    }
+
     public SysUser()
     {
 

+ 5 - 1
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="sex"          column="sex"          />
         <result property="avatar"       column="avatar"       />
         <result property="password"     column="password"     />
+        <result property="passwordMw"     column="password_mw"     />
         <result property="status"       column="status"       />
         <result property="delFlag"      column="del_flag"     />
         <result property="loginIp"      column="login_ip"     />
@@ -153,6 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
  			<if test="sex != null and sex != ''">sex,</if>
  			<if test="password != null and password != ''">password,</if>
+ 			<if test="passwordMw != null and passwordMw != ''">password_mw,</if>
  			<if test="status != null and status != ''">status,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
  			<if test="remark != null and remark != ''">remark,</if>
@@ -167,6 +169,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
  			<if test="sex != null and sex != ''">#{sex},</if>
  			<if test="password != null and password != ''">#{password},</if>
+ 			<if test="passwordMw != null and passwordMw != ''">#{passwordMw},</if>
  			<if test="status != null and status != ''">#{status},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
@@ -185,6 +188,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="sex != null and sex != ''">sex = #{sex},</if>
  			<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
  			<if test="password != null and password != ''">password = #{password},</if>
+ 			<if test="passwordMw != null and passwordMw != ''">password_mw = #{passwordMw},</if>
  			<if test="status != null and status != ''">status = #{status},</if>
  			<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
  			<if test="loginDate != null">login_date = #{loginDate},</if>
@@ -218,7 +222,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach> 
  	</delete>
 	<select id="getByPhone" resultMap="SysUserResult">
-		<include refid="selectUserVo"/>
+		select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password,u.password_mw, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark from sys_user u
 		where u.phonenumber = #{phone}  and u.del_flag = '0' limit 1;
 	</select>
 </mapper>