mirror of https://github.com/rancher/ui.git
Merge pull request #3261 from vincent99/master
Delete keys option on change password
This commit is contained in:
commit
ea8f751d4e
|
|
@ -4,6 +4,7 @@ import { get, set, computed, observer } from '@ember/object';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { later, run } from '@ember/runloop';
|
import { later, run } from '@ember/runloop';
|
||||||
import { randomStr } from 'shared/utils/util';
|
import { randomStr } from 'shared/utils/util';
|
||||||
|
import { resolve, all } from 'rsvp';
|
||||||
|
|
||||||
const CHANGE = 'change';
|
const CHANGE = 'change';
|
||||||
const SET = 'set';
|
const SET = 'set';
|
||||||
|
|
@ -22,11 +23,13 @@ export default Component.extend({
|
||||||
editLabel: 'modalEditPassword.actionButton',
|
editLabel: 'modalEditPassword.actionButton',
|
||||||
currentPassword: null,
|
currentPassword: null,
|
||||||
user: null,
|
user: null,
|
||||||
|
showDeleteTokens: false,
|
||||||
|
|
||||||
confirmBlurred: false,
|
confirmBlurred: false,
|
||||||
serverErrors: null,
|
serverErrors: null,
|
||||||
password: null,
|
password: null,
|
||||||
confirm: null,
|
confirm: null,
|
||||||
|
deleteTokens: false,
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
if ( get(this, 'generate') ) {
|
if ( get(this, 'generate') ) {
|
||||||
|
|
@ -69,8 +72,23 @@ export default Component.extend({
|
||||||
promise = user.doAction('setpassword', { newPassword: neu.trim(), });
|
promise = user.doAction('setpassword', { newPassword: neu.trim(), });
|
||||||
}
|
}
|
||||||
|
|
||||||
return promise.then(() => get(this, 'access').loadMe()
|
return promise.then(() => get(this, 'access').loadMe().then(() => {
|
||||||
.then(() => {
|
if ( get(this, 'deleteTokens') ) {
|
||||||
|
return get(this, 'globalStore').findAll('token').then((tokens) => {
|
||||||
|
const promises = [];
|
||||||
|
|
||||||
|
tokens.forEach((token) => {
|
||||||
|
if ( !token.current ) {
|
||||||
|
promises.push(token.delete());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return all(promises);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return resolve();
|
||||||
|
}
|
||||||
|
}).then(() => {
|
||||||
get(this, 'complete')(true);
|
get(this, 'complete')(true);
|
||||||
later(this, () => {
|
later(this, () => {
|
||||||
if ( this.isDestroyed || this.isDestroying ) {
|
if ( this.isDestroyed || this.isDestroying ) {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@
|
||||||
style="display: none;"
|
style="display: none;"
|
||||||
/>
|
/>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
{{#if showDeleteTokens}}
|
||||||
|
<label>{{input type="checkbox" checked=deleteTokens}} {{t 'modalEditPassword.deleteTokens'}}</label>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if showCurrent}}
|
{{#if showCurrent}}
|
||||||
<div class="row mb-20">
|
<div class="row mb-20">
|
||||||
<div class="col span-12">
|
<div class="col span-12">
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
{{input-edit-password
|
{{input-edit-password
|
||||||
complete=(action "complete")
|
complete=(action "complete")
|
||||||
showCurrent=true
|
showCurrent=true
|
||||||
|
showDeleteTokens=true
|
||||||
cancel=(action "cancel")
|
cancel=(action "cancel")
|
||||||
editButton='modalEditPassword.actionButton'
|
editButton='modalEditPassword.actionButton'
|
||||||
user=user
|
user=user
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,7 @@
|
||||||
@value={{config.kubernetesVersion}}
|
@value={{config.kubernetesVersion}}
|
||||||
@versions={{versionChoices}}
|
@versions={{versionChoices}}
|
||||||
@clusterTemplateQuestions={{clusterTemplateQuestions}}
|
@clusterTemplateQuestions={{clusterTemplateQuestions}}
|
||||||
|
@showNotAllowed=true
|
||||||
/>
|
/>
|
||||||
</CheckOverrideAllowed>
|
</CheckOverrideAllowed>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ export default Component.extend({
|
||||||
disabled: false,
|
disabled: false,
|
||||||
value: null,
|
value: null,
|
||||||
mode: 'new',
|
mode: 'new',
|
||||||
|
showNotAllowed: false,
|
||||||
editing: equal('mode', 'edit'),
|
editing: equal('mode', 'edit'),
|
||||||
isView: equal('mode', 'view'),
|
isView: equal('mode', 'view'),
|
||||||
|
|
||||||
|
|
@ -135,11 +136,13 @@ export default Component.extend({
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
const suffix = ( this.showNotAllowed ? 'formVersions.notallowed' : 'formVersions.unsupported' );
|
||||||
|
|
||||||
if (gt(version, coerceVersion(maxVersion))) {
|
if (gt(version, coerceVersion(maxVersion))) {
|
||||||
if (overrideMatch && !isEmpty(overrideMatch.satisfies)) {
|
if (overrideMatch && !isEmpty(overrideMatch.satisfies)) {
|
||||||
out = {
|
out = {
|
||||||
disabled: true,
|
disabled: true,
|
||||||
label: `${ label } ${ this.intl.t('formVersions.unsupported') }`,
|
label: `${ label } ${ this.intl.t(suffix) }`,
|
||||||
value: v
|
value: v
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -152,7 +155,7 @@ export default Component.extend({
|
||||||
} else if (lt(version, coerceVersion(maxVersion))) {
|
} else if (lt(version, coerceVersion(maxVersion))) {
|
||||||
out = {
|
out = {
|
||||||
disabled: true,
|
disabled: true,
|
||||||
label: `${ label } ${ this.intl.t('formVersions.unsupported') }`,
|
label: `${ label } ${ this.intl.t(suffix) }`,
|
||||||
value: v
|
value: v
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "ui",
|
"name": "ui",
|
||||||
"version": "2.3.2",
|
"version": "2.3.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"repository": "https://github.com/rancher/ui",
|
"repository": "https://github.com/rancher/ui",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|
|
||||||
|
|
@ -5579,7 +5579,8 @@ formVersions:
|
||||||
experimental: "(experimental)"
|
experimental: "(experimental)"
|
||||||
dotx: "Latest {minor} (allows patch version upgrades)"
|
dotx: "Latest {minor} (allows patch version upgrades)"
|
||||||
downgrade: "(can't downgrade)"
|
downgrade: "(can't downgrade)"
|
||||||
unsupported: "(not allowed by template)"
|
notallowed: "(not allowed by template)"
|
||||||
|
unsupported: "(unsupported)"
|
||||||
|
|
||||||
formIstioHost:
|
formIstioHost:
|
||||||
prompt: Select a host...
|
prompt: Select a host...
|
||||||
|
|
@ -6154,6 +6155,7 @@ modalEditPassword:
|
||||||
mode:
|
mode:
|
||||||
generate: 'Use a new randomly generated password:'
|
generate: 'Use a new randomly generated password:'
|
||||||
manual: 'Set a specific password to use:'
|
manual: 'Set a specific password to use:'
|
||||||
|
deleteTokens: Delete all existing API keys
|
||||||
|
|
||||||
modalFeedback:
|
modalFeedback:
|
||||||
header: Welcome to {appName}!
|
header: Welcome to {appName}!
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue