feat: 用户登陆修改密码

This commit is contained in:
taojinlong 2023-02-15 15:58:01 +08:00
parent 77c39f24ad
commit 9445c96b50
3 changed files with 8 additions and 2 deletions

View File

@ -63,6 +63,7 @@ public class AuthServer implements AuthApi {
@Override
public Object login(@RequestBody LoginDto loginDto) throws Exception {
Map<String, Object> result = new HashMap<>();
String username = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, loginDto.getUsername());
String pwd = RsaUtil.decryptByPrivateKey(RsaProperties.privateKey, loginDto.getPassword());
@ -147,9 +148,11 @@ public class AuthServer implements AuthApi {
AccountLockStatus lockStatus = authUserService.recordLoginFail(username, 0);
DataEaseException.throwException(appendLoginErrorMsg(Translator.get("i18n_id_or_pwd_error"), lockStatus));
}
if(user.getIsAdmin() && user.getPassword().equals("40b8893ea9ebc2d631c4bb42bb1e8996")){
result.put("passwordModified", false);
}
}
Map<String, Object> result = new HashMap<>();
TokenInfo tokenInfo = TokenInfo.builder().userId(user.getUserId()).username(username).build();
String token = JWTUtils.sign(tokenInfo, realPwd);
// 记录token操作时间

View File

@ -12,7 +12,7 @@
:title="$t('user.change_password')"
:show-close="false"
>
<PasswordUpdateForm oldPwd="DataEase" />
<PasswordUpdateForm oldPwd="dataease" />
</el-dialog>
</div>
</template>

View File

@ -83,6 +83,9 @@ const actions = {
commit('SET_TOKEN', data.token)
commit('SET_LOGIN_MSG', null)
setToken(data.token)
if(data.hasOwnProperty('passwordModified')){
commit('SET_PASSWORD_MODIFIED', data.passwordModified)
}
resolve()
}).catch(error => {
reject(error)