登录记住密码问题、管理员重置密码问题
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.nl.modules.system.service.impl;
|
package org.nl.modules.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nl.config.FileProperties;
|
import org.nl.config.FileProperties;
|
||||||
@@ -35,6 +36,7 @@ import org.springframework.cache.annotation.CacheConfig;
|
|||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -61,6 +63,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
private final RedisUtils redisUtils;
|
private final RedisUtils redisUtils;
|
||||||
private final UserCacheClean userCacheClean;
|
private final UserCacheClean userCacheClean;
|
||||||
private final OnlineUserService onlineUserService;
|
private final OnlineUserService onlineUserService;
|
||||||
|
private final PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
|
public Object queryAll(UserQueryCriteria criteria, Pageable pageable) {
|
||||||
@@ -135,6 +138,8 @@ public class UserServiceImpl implements UserService {
|
|||||||
user.setGender(resources.getGender());
|
user.setGender(resources.getGender());
|
||||||
user.setExtId(resources.getExtId());
|
user.setExtId(resources.getExtId());
|
||||||
user.setExtuserId(resources.getExtuserId());
|
user.setExtuserId(resources.getExtuserId());
|
||||||
|
if (ObjectUtil.isNotEmpty(resources.getPassword()))
|
||||||
|
user.setPassword(passwordEncoder.encode(resources.getPassword()));
|
||||||
userRepository.save(user);
|
userRepository.save(user);
|
||||||
// 清除缓存
|
// 清除缓存
|
||||||
delCaches(user.getId(), user.getUsername());
|
delCaches(user.getId(), user.getUsername());
|
||||||
|
|||||||
@@ -119,14 +119,14 @@ export default {
|
|||||||
code: this.loginForm.code,
|
code: this.loginForm.code,
|
||||||
uuid: this.loginForm.uuid
|
uuid: this.loginForm.uuid
|
||||||
}
|
}
|
||||||
if (user.password !== this.cookiePass) {
|
user.password = encrypt(user.password)
|
||||||
user.password = encrypt(user.password)
|
// if (user.password !== this.cookiePass) {
|
||||||
}
|
// }
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
if (user.rememberMe) {
|
if (user.rememberMe) {
|
||||||
Cookies.set('username', user.username, { expires: Config.passCookieExpires })
|
Cookies.set('username', user.username, { expires: Config.passCookieExpires })
|
||||||
Cookies.set('password', user.password, { expires: Config.passCookieExpires })
|
Cookies.set('password', this.loginForm.password, { expires: Config.passCookieExpires })
|
||||||
Cookies.set('rememberMe', user.rememberMe, { expires: Config.passCookieExpires })
|
Cookies.set('rememberMe', user.rememberMe, { expires: Config.passCookieExpires })
|
||||||
} else {
|
} else {
|
||||||
Cookies.remove('username')
|
Cookies.remove('username')
|
||||||
|
|||||||
@@ -132,7 +132,7 @@
|
|||||||
<el-form-item style="margin-bottom: 0;" label="角色" prop="roles">
|
<el-form-item style="margin-bottom: 0;" label="角色" prop="roles">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="roleDatas"
|
v-model="roleDatas"
|
||||||
style="width: 512px"
|
style="width: 200px"
|
||||||
multiple
|
multiple
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
@remove-tag="deleteTag"
|
@remove-tag="deleteTag"
|
||||||
@@ -147,6 +147,9 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="重置密码" prop="extId">
|
||||||
|
<el-input v-model="form.password" style="width: 200px;" show-password/>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||||
@@ -241,7 +244,8 @@ const defaultForm = {
|
|||||||
dept: { id: null },
|
dept: { id: null },
|
||||||
phone: null,
|
phone: null,
|
||||||
extId: null,
|
extId: null,
|
||||||
extuserId: null
|
extuserId: null,
|
||||||
|
password: null
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'User',
|
name: 'User',
|
||||||
|
|||||||
Reference in New Issue
Block a user