feat: 创建用户页面提示默认密码

This commit is contained in:
fit2cloud-chenyw 2022-04-14 13:02:42 +08:00
parent 1028f38e19
commit 61901be4f7
8 changed files with 55 additions and 3 deletions

View File

@ -30,6 +30,10 @@ public interface AuthApi {
@PostMapping("/useInitPwd")
Boolean useInitPwd();
@ApiOperation("用户初始密码")
@PostMapping("/defaultPwd")
String defaultPwd();
@ApiOperation("登出")
@PostMapping("/logout")
String logout();

View File

@ -154,6 +154,11 @@ public class AuthServer implements AuthApi {
return StringUtils.equals(AuthUtils.getUser().getPassword(), md5);
}
@Override
public String defaultPwd() {
return DEFAULT_PWD;
}
@Override
public String logout() {
String token = ServletUtils.getToken();

View File

@ -29,6 +29,13 @@ export function needModifyPwd() {
})
}
export function defaultPwd() {
return request({
url: '/api/auth/defaultPwd',
method: 'post'
})
}
export function validateUserName(data) {
return request({
url: '/api/auth/validateName',

View File

@ -131,6 +131,7 @@ export default {
default_login: 'Normal'
},
commons: {
default_pwd: 'Default Pwd',
stop: 'Stop',
first_login_tips: 'Please change the initial password',
roger_that: 'Roger That',

View File

@ -131,6 +131,7 @@ export default {
default_login: '普通登錄'
},
commons: {
default_pwd: '初始密碼',
stop: '停止',
first_login_tips: '您使用的是初始密碼,記得修改密碼哦',
roger_that: '知道了',

View File

@ -131,6 +131,7 @@ export default {
default_login: '普通登录'
},
commons: {
default_pwd: '初始密码',
stop: '停止',
first_login_tips: '您使用的是初始密码,记得修改密码哦',
roger_that: '知道了',

View File

@ -811,3 +811,9 @@ div:focus {
padding-top: 0px;
}
}
.pwd-tips > span {
font-weight: 800;
color: #F56C6C;
}

View File

@ -69,6 +69,19 @@
<el-button type="primary" @click="save">{{ $t('commons.confirm') }}</el-button>
<el-button @click="reset">{{ $t('commons.reset') }}</el-button>
</el-form-item>
<el-form-item>
<!-- <el-link class="pwd-tips" type="danger" :underline="false">{{ $t('commons.default_pwd') + '' + defaultPWD }}</el-link> -->
<el-button class="pwd-tips" type="text">{{ $t('commons.default_pwd') + '' + defaultPWD }}</el-button>
<el-button
v-clipboard:copy="defaultPWD"
v-clipboard:success="onCopy"
v-clipboard:error="onError"
type="text"
>
{{ $t('commons.copy') }}
</el-button>
</el-form-item>
</el-form>
</layout-content>
@ -79,7 +92,7 @@ import LayoutContent from '@/components/business/LayoutContent'
import { PHONE_REGEX } from '@/utils/validate'
import { getDeptTree, treeByDeptId } from '@/api/system/dept'
import { addUser, editUser, allRoles } from '@/api/system/user'
import { pluginLoaded } from '@/api/user'
import { pluginLoaded, defaultPwd } from '@/api/user'
export default {
components: { LayoutContent },
@ -160,7 +173,8 @@ export default {
roleDatas: [],
userRoles: [],
formType: 'add',
isPluginLoaded: false
isPluginLoaded: false,
defaultPWD: 'DataEase123..'
}
},
@ -183,6 +197,11 @@ export default {
pluginLoaded().then(res => {
this.isPluginLoaded = res.success && res.data
})
defaultPwd().then(res => {
if (res && res.data) {
this.defaultPWD = res.data
}
})
},
methods: {
entryKey(event) {
@ -320,7 +339,15 @@ export default {
return node
})
this.depts = results
}
},
onCopy(e) {
this.$success(this.$t('commons.copy_success'))
},
onError(e) {}
}
}
</script>
<style lang="scss" scoped>
</style>