feat: temp password

This commit is contained in:
jiangweidong 2022-04-13 17:43:34 +08:00 committed by 老广
parent 6d8dc058cb
commit b85db6b73f
2 changed files with 23 additions and 18 deletions

View File

@ -1066,7 +1066,7 @@
"refreshLdapCache":"Refreshing Ldap cache ", "refreshLdapCache":"Refreshing Ldap cache ",
"LicenseExpired": "License expired", "LicenseExpired": "License expired",
"LicenseWillBe": "License will expire at ", "LicenseWillBe": "License will expire at ",
"Expire": "", "Expire": "Expire",
"WeCom": "WeCom", "WeCom": "WeCom",
"DingTalk": "DingTalk", "DingTalk": "DingTalk",
"dingTalkTest": "Test", "dingTalkTest": "Test",

View File

@ -15,40 +15,45 @@ export default {
GenericListPage GenericListPage
}, },
data() { data() {
const ajaxUrl = '/api/v1/authentication/temp-password/' const ajaxUrl = '/api/v1/authentication/temp-tokens/'
return { return {
helpMessage: this.$t('setting.helpText.TempPassword'), helpMessage: this.$t('setting.helpText.TempPassword'),
tableConfig: { tableConfig: {
hasSelection: true, hasSelection: true,
url: ajaxUrl, url: ajaxUrl,
columns: [ columns: [
'temp_password', 'expire', 'actions' 'username', 'secret', 'date_expired', 'date_verified', 'is_valid', 'actions'
], ],
columnsMeta: { columnsMeta: {
temp_password: { secret: {
label: this.$t('common.nav.TempPassword') label: this.$t('common.nav.TempPassword')
}, },
expire: { expire: {
label: this.$t('setting.Expired') + '( s )', label: this.$t('setting.Expired') + '( s )'
width: '100px'
}, },
actions: { actions: {
prop: '', prop: '',
formatterArgs: { formatterArgs: {
hasUpdate: false, hasUpdate: false,
hasClone: false, hasClone: false,
canDelete: true, hasDelete: false,
onDelete: function({ row }) { extraActions: [
this.$axios.delete( {
`/api/v1/authentication/temp-password/` name: 'Expired',
title: this.$t('setting.Expire'),
type: 'info',
callback: function({ row }) {
this.$axios.patch(`${ajaxUrl}${row.id}/expire/`,
).then(res => { ).then(res => {
this.getRefsListTable.reloadTable() this.getRefsListTable.reloadTable()
this.$message.success(this.$t('common.deleteSuccessMsg')) this.$message.success(this.$t('common.updateSuccessMsg'))
}).catch(error => { }).catch(error => {
this.$message.error(this.$t('common.deleteErrorMsg') + ' ' + error) this.$message.error(this.$t('common.updateErrorMsg' + ' ' + error))
}) })
}.bind(this) }.bind(this)
} }
]
}
} }
} }
}, },
@ -68,7 +73,7 @@ export default {
can: true, can: true,
callback: function() { callback: function() {
this.$axios.post( this.$axios.post(
`/api/v1/authentication/temp-password/` `/api/v1/authentication/temp-tokens/`
).then(res => { ).then(res => {
this.getRefsListTable.reloadTable() this.getRefsListTable.reloadTable()
this.$message.success(this.$t('common.updateSuccessMsg')) this.$message.success(this.$t('common.updateSuccessMsg'))