mirror of https://github.com/rancher/ui.git
Change password fixes
This commit is contained in:
parent
6c261cf86f
commit
ef6e6e65fb
|
|
@ -42,9 +42,8 @@ export default Controller.extend({
|
|||
},
|
||||
|
||||
complete(success) {
|
||||
set(this, 'code', null);
|
||||
|
||||
if (success) {
|
||||
set(this, 'code', null);
|
||||
get(this, 'router').replaceWith('authenticated');
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ export default Component.extend({
|
|||
user: null,
|
||||
|
||||
confirmBlurred: false,
|
||||
serverErrors: null,
|
||||
|
||||
didReceiveAttrs() {
|
||||
run.next(function() {
|
||||
|
|
@ -31,8 +32,9 @@ export default Component.extend({
|
|||
return !pass || !confirm || pass !== confirm;
|
||||
}),
|
||||
|
||||
errors: computed('saveDisabled', 'confirm', 'confirmBlurred', function() {
|
||||
let out = [];
|
||||
errors: computed('saveDisabled', 'confirm', 'confirmBlurred', 'serverErrors.[]', function() {
|
||||
let out = get(this, 'serverErrors')||[];
|
||||
|
||||
if ( get(this, 'confirmBlurred') && get(this, 'confirm') && get(this, 'saveDisabled') ) {
|
||||
out.push(get(this, 'intl').t('modalEditPassword.mismatch'));
|
||||
}
|
||||
|
|
@ -50,6 +52,8 @@ export default Component.extend({
|
|||
const old = get(this, 'currentPassword');
|
||||
const neu = get(this, 'password');
|
||||
|
||||
set(this, 'serverErrors', []);
|
||||
|
||||
if (typeof get(this, 'overrideSave') === 'function') {
|
||||
this.sendAction('overrideSave', get(this, 'password'));
|
||||
// } else if ( false && user.hasAction('setpassword') ) {
|
||||
|
|
@ -72,7 +76,7 @@ export default Component.extend({
|
|||
}).then(() => {
|
||||
this.sendAction('complete', user);
|
||||
}).catch((err) => {
|
||||
set(this, 'errors', [err]);
|
||||
set(this, 'serverErrors', [err.message]);
|
||||
this.sendAction('complete', false);
|
||||
}).finally(() => {
|
||||
cb();
|
||||
|
|
|
|||
Loading…
Reference in New Issue