Commit 8f8a5050 authored by 李永强's avatar 李永强

修复bug

parent 114b1240
Pipeline #214 canceled with stages
......@@ -65,12 +65,12 @@ public class LoginIntercept implements HandlerInterceptor {
returnJson(response, result);
return false;
}
if (user.getStopUse()) {
if (user.getStopUse() != null && user.getStopUse()) {
ApiResult result = new ApiResult(Constants.INVALID_USER);
returnJson(response, result);
return false;
}
if (user.getResetPassword()) {
if (user.getResetPassword() != null && user.getResetPassword()) {
ApiResult result = new ApiResult(Constants.FAIL, "第一次登录请修改密码");
returnJson(response, result);
return false;
......
......@@ -3,6 +3,7 @@ package com.restful.utils;
import com.restful.common.Constants;
import com.restful.common.entity.ServiceException;
import com.restful.domain.User;
import org.apache.commons.codec.digest.DigestUtils;
public class PasswordUtils {
......@@ -10,7 +11,7 @@ public class PasswordUtils {
private static final String publicSalt = "a_simple_salt";
public static void login(CacheUtils cacheUtils, User user, String password) throws ServiceException {
if (user.getStopUse())
if (user.getStopUse() != null && user.getStopUse())
throw new ServiceException(Constants.INVALID_USER);
Integer integer = cacheUtils.getRetryCount(user.getId());
if (integer != null && integer >= 5) {
......@@ -23,20 +24,18 @@ public class PasswordUtils {
cacheUtils.delRetryCount(user.getId());
}
public static boolean matching(String realPassword, String password) {
/*String salt = DigestUtils.md5Hex(password + publicSalt);
private static boolean matching(String realPassword, String password) {
String salt = DigestUtils.md5Hex(password + publicSalt);
password = DigestUtils.md5Hex(password + salt);
if (realPassword.equals(password)) {
return true;
}
return false;*/
return realPassword.equals(password);
return false;
}
public static String encryption(String password) {
/*String salt = DigestUtils.md5Hex(password + publicSalt);
return DigestUtils.md5Hex(password + salt);*/
return password;
String salt = DigestUtils.md5Hex(password + publicSalt);
return DigestUtils.md5Hex(password + salt);
}
}
......@@ -20,9 +20,8 @@
</resultMap>
<insert id="addUser" useGeneratedKeys="true" keyProperty="id">
insert into users (user_username, user_password, user_name, user_create_time, user_update_time, user_phone,
user_company)
values (#{userName}, #{password}, #{name}, #{createTime}, #{updateTime}, #{phone}, #{company.id})
insert into users (user_username, user_password, user_name, user_create_time, user_update_time, user_phone)
values (#{userName}, #{password}, #{name}, #{createTime}, #{updateTime}, #{phone})
</insert>
<select id="getUserById" resultMap="userMap_ex">
......@@ -47,9 +46,6 @@
left join user_role on ur_user_id = user_id
left join role on role_id = ur_role_id
where role_id = '${@com.jianju.detecting.field.RoleTable@detection_admin.id}'
<if test="companyId!=null">
and user_company = #{companyId}
</if>
<if test="name!=null">
and user_name like '%'||#{name}||'%'
</if>
......@@ -70,9 +66,6 @@
<if test="roleId!=null">
and ur_role_id = #{roleId}
</if>
<if test="companyId!=null">
and user_company = #{companyId}
</if>
<if test="username != null">
and user_username = #{username}
</if>
......
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