feat:
1. add APPUserController
This commit is contained in:
@@ -17,6 +17,7 @@ import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.mp.enums.StatusType;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.oauth2.exception.ExceptionCode;
|
||||
import org.springblade.core.oauth2.exception.OAuth2Exception;
|
||||
import org.springblade.core.oauth2.props.OAuth2Properties;
|
||||
import org.springblade.core.redis.cache.BladeRedis;
|
||||
@@ -44,6 +45,7 @@ import java.util.Objects;
|
||||
|
||||
import static org.springblade.common.constant.CommonConstant.DEFAULT_PARAM_PASSWORD;
|
||||
import static org.springblade.core.cache.constant.CacheConstant.USER_CACHE;
|
||||
import static org.springblade.modules.auth.constant.BladeAuthConstant.INIT_PASSWD_VALUE;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
@@ -595,14 +597,15 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
||||
@Override
|
||||
public Boolean hasChangedPassword() {
|
||||
User user = getById(AuthUtil.getUserId());
|
||||
return user.getCreateTime() == user.getUpdateTime();
|
||||
Assert.notNull(user, ExceptionCode.INVALID_USER.getMessage());
|
||||
return !user.getPassword().equalsIgnoreCase(DigestUtil.encrypt(ParamCache.getValue(INIT_PASSWD_VALUE)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean changePassword(String password) {
|
||||
Assert.isTrue(StringUtil.isNotBlank(password), "无效密码");
|
||||
Assert.isTrue(StringUtil.isNotBlank(password), ExceptionCode.INVALID_USER_PASSWORD.getMessage());
|
||||
User user = getById(AuthUtil.getUserId());
|
||||
user.setPassword(SM2Util.decrypt(password, properties.getPublicKey(), properties.getPrivateKey()));
|
||||
user.setPassword(DigestUtil.encrypt(SM2Util.decrypt(password, properties.getPublicKey(), properties.getPrivateKey())));
|
||||
return updateById(user);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user