mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
iam: Add user - duplicated password field (#217)
Fixes #175 Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
bb1e135b52
commit
7f591e71ea
@ -53,7 +53,7 @@ export default {
|
|||||||
icon: 'plus',
|
icon: 'plus',
|
||||||
label: 'label.add.account',
|
label: 'label.add.account',
|
||||||
listView: true,
|
listView: true,
|
||||||
args: ['username', 'password', 'email', 'firstname', 'lastname', 'domainid', 'account', 'roleid', 'timezone', 'networkdomain']
|
args: ['username', 'password', 'confirmpassword', 'email', 'firstname', 'lastname', 'domainid', 'account', 'roleid', 'timezone', 'networkdomain']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
api: 'ldapCreateAccount',
|
api: 'ldapCreateAccount',
|
||||||
|
|||||||
@ -29,7 +29,7 @@ export default {
|
|||||||
icon: 'plus',
|
icon: 'plus',
|
||||||
label: 'label.add.user',
|
label: 'label.add.user',
|
||||||
listView: true,
|
listView: true,
|
||||||
args: ['username', 'password', 'email', 'firstname', 'lastname', 'timezone', 'account', 'domainid']
|
args: ['username', 'password', 'confirmpassword', 'email', 'firstname', 'lastname', 'timezone', 'account', 'domainid']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
api: 'updateUser',
|
api: 'updateUser',
|
||||||
|
|||||||
@ -539,6 +539,7 @@
|
|||||||
"label.confirmation": "Confirmation",
|
"label.confirmation": "Confirmation",
|
||||||
"label.confirmdeclineinvitation": "Are you sure you want to decline this project invitation?",
|
"label.confirmdeclineinvitation": "Are you sure you want to decline this project invitation?",
|
||||||
"label.confirmpassword": "Confirm Password",
|
"label.confirmpassword": "Confirm Password",
|
||||||
|
"label.confirmpassword.description": "Please type the same password again",
|
||||||
"label.congratulations": "Congratulations!",
|
"label.congratulations": "Congratulations!",
|
||||||
"label.connectiontimeout": "Connection Timeout",
|
"label.connectiontimeout": "Connection Timeout",
|
||||||
"label.conservemode": "Conserve mode",
|
"label.conservemode": "Conserve mode",
|
||||||
|
|||||||
@ -231,12 +231,21 @@
|
|||||||
:placeholder="field.description"
|
:placeholder="field.description"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="field.name==='password' || field.name==='currentpassword'">
|
<span v-else-if="field.name==='password' || field.name==='currentpassword' || field.name==='confirmpassword'">
|
||||||
<a-input-password
|
<a-input-password
|
||||||
v-decorator="[field.name, {
|
v-decorator="[field.name, {
|
||||||
rules: [{ required: field.required, message: `${$t('message.error.required.input')}` }]
|
rules: [
|
||||||
|
{
|
||||||
|
required: field.required,
|
||||||
|
message: `${$t('message.error.required.input')}`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
validator: validateTwoPassword
|
||||||
|
}
|
||||||
|
]
|
||||||
}]"
|
}]"
|
||||||
:placeholder="field.description"
|
:placeholder="field.description"
|
||||||
|
@blur="($event) => handleConfirmBlur($event, field.name)"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="field.name==='certificate' || field.name==='privatekey' || field.name==='certchain'">
|
<span v-else-if="field.name==='certificate' || field.name==='privatekey' || field.name==='certchain'">
|
||||||
@ -357,7 +366,8 @@ export default {
|
|||||||
treeData: [],
|
treeData: [],
|
||||||
treeSelected: {},
|
treeSelected: {},
|
||||||
actionData: [],
|
actionData: [],
|
||||||
formModel: {}
|
formModel: {},
|
||||||
|
confirmDirty: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -609,6 +619,7 @@ export default {
|
|||||||
this.currentAction = {}
|
this.currentAction = {}
|
||||||
},
|
},
|
||||||
execAction (action) {
|
execAction (action) {
|
||||||
|
const self = this
|
||||||
this.form = this.$form.createForm(this)
|
this.form = this.$form.createForm(this)
|
||||||
this.formModel = {}
|
this.formModel = {}
|
||||||
this.actionData = []
|
this.actionData = []
|
||||||
@ -635,6 +646,14 @@ export default {
|
|||||||
}
|
}
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
this.currentAction.paramFields = args.map(function (arg) {
|
this.currentAction.paramFields = args.map(function (arg) {
|
||||||
|
if (arg === 'confirmpassword') {
|
||||||
|
return {
|
||||||
|
type: 'password',
|
||||||
|
name: 'confirmpassword',
|
||||||
|
required: true,
|
||||||
|
description: self.$t('label.confirmpassword.description')
|
||||||
|
}
|
||||||
|
}
|
||||||
return paramFields.filter(function (param) {
|
return paramFields.filter(function (param) {
|
||||||
return param.name.toLowerCase() === arg.toLowerCase()
|
return param.name.toLowerCase() === arg.toLowerCase()
|
||||||
})[0]
|
})[0]
|
||||||
@ -908,6 +927,40 @@ export default {
|
|||||||
},
|
},
|
||||||
finishLoading () {
|
finishLoading () {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
},
|
||||||
|
handleConfirmBlur (e, name) {
|
||||||
|
if (name !== 'confirmpassword') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const value = e.target.value
|
||||||
|
this.confirmDirty = this.confirmDirty || !!value
|
||||||
|
},
|
||||||
|
validateTwoPassword (rule, value, callback) {
|
||||||
|
if (!value || value.length === 0) {
|
||||||
|
callback()
|
||||||
|
} else if (rule.field === 'confirmpassword') {
|
||||||
|
const form = this.form
|
||||||
|
const messageConfirm = this.$t('message.validate.equalto')
|
||||||
|
const passwordVal = form.getFieldValue('password')
|
||||||
|
if (passwordVal && passwordVal !== value) {
|
||||||
|
callback(messageConfirm)
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
} else if (rule.field === 'password') {
|
||||||
|
const form = this.form
|
||||||
|
const confirmPasswordVal = form.getFieldValue('confirmpassword')
|
||||||
|
if (!confirmPasswordVal || confirmPasswordVal.length === 0) {
|
||||||
|
callback()
|
||||||
|
} else if (value && this.confirmDirty) {
|
||||||
|
form.validateFields(['confirmpassword'], { force: true })
|
||||||
|
callback()
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user