mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 18:17:55 +00:00
UI: [VAULT-19783] Set up root token warning modal (#23277)
This commit is contained in:
3
changelog/23277.txt
Normal file
3
changelog/23277.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:improvement
|
||||||
|
ui: Add warning message to the namespace picker warning users about the behavior when logging in with a root token.
|
||||||
|
```
|
||||||
@@ -25,10 +25,4 @@ export default class DashboardVaultVersionTitle extends Component {
|
|||||||
? `Vault v${this.version.version.slice(0, this.version.version.indexOf('+'))}`
|
? `Vault v${this.version.version.slice(0, this.version.version.indexOf('+'))}`
|
||||||
: `Vault v${this.version.version}`;
|
: `Vault v${this.version.version}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
get namespaceDisplay() {
|
|
||||||
if (this.namespace.inRootNamespace) return 'root';
|
|
||||||
const parts = this.namespace.path?.split('/');
|
|
||||||
return parts[parts.length - 1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
* Copyright (c) HashiCorp, Inc.
|
* Copyright (c) HashiCorp, Inc.
|
||||||
* SPDX-License-Identifier: BUSL-1.1
|
* SPDX-License-Identifier: BUSL-1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import { alias } from '@ember/object/computed';
|
import { alias } from '@ember/object/computed';
|
||||||
import Controller, { inject as controller } from '@ember/controller';
|
import Controller, { inject as controller } from '@ember/controller';
|
||||||
@@ -67,6 +66,7 @@ export default Controller.extend({
|
|||||||
}
|
}
|
||||||
transition.followRedirects().then(() => {
|
transition.followRedirects().then(() => {
|
||||||
if (isRoot) {
|
if (isRoot) {
|
||||||
|
this.auth.set('isRootToken', true);
|
||||||
this.flashMessages.warning(
|
this.flashMessages.warning(
|
||||||
'You have logged in with a root token. As a security precaution, this root token will not be stored by your browser and you will need to re-authenticate after the window is closed or refreshed.'
|
'You have logged in with a root token. As a security precaution, this root token will not be stored by your browser and you will need to re-authenticate after the window is closed or refreshed.'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export default Service.extend({
|
|||||||
expirationCalcTS: null,
|
expirationCalcTS: null,
|
||||||
isRenewing: false,
|
isRenewing: false,
|
||||||
mfaErrors: null,
|
mfaErrors: null,
|
||||||
|
isRootToken: false,
|
||||||
|
|
||||||
get tokenExpired() {
|
get tokenExpired() {
|
||||||
const expiration = this.tokenExpirationDate;
|
const expiration = this.tokenExpirationDate;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
import { alias, equal } from '@ember/object/computed';
|
import { alias, equal } from '@ember/object/computed';
|
||||||
import Service, { inject as service } from '@ember/service';
|
import Service, { inject as service } from '@ember/service';
|
||||||
import { task } from 'ember-concurrency';
|
import { task } from 'ember-concurrency';
|
||||||
|
import { computed } from '@ember/object';
|
||||||
|
|
||||||
const ROOT_NAMESPACE = '';
|
const ROOT_NAMESPACE = '';
|
||||||
export default Service.extend({
|
export default Service.extend({
|
||||||
@@ -20,6 +21,13 @@ export default Service.extend({
|
|||||||
|
|
||||||
inRootNamespace: equal('path', ROOT_NAMESPACE),
|
inRootNamespace: equal('path', ROOT_NAMESPACE),
|
||||||
|
|
||||||
|
currentNamespace: computed('inRootNamespace', 'path', function () {
|
||||||
|
if (this.inRootNamespace) return 'root';
|
||||||
|
|
||||||
|
const parts = this.path?.split('/');
|
||||||
|
return parts[parts.length - 1];
|
||||||
|
}),
|
||||||
|
|
||||||
setNamespace(path) {
|
setNamespace(path) {
|
||||||
if (!path) {
|
if (!path) {
|
||||||
this.set('path', '');
|
this.set('path', '');
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<h1 class="title is-3" data-test-dashboard-card-header="Vault version">
|
<h1 class="title is-3" data-test-dashboard-card-header="Vault version">
|
||||||
{{this.versionHeader}}
|
{{this.versionHeader}}
|
||||||
{{#if @version.isEnterprise}}
|
{{#if @version.isEnterprise}}
|
||||||
<Hds::Badge @text={{this.namespaceDisplay}} @icon="org" data-test-badge-namespace />
|
<Hds::Badge @text={{this.namespace.currentNamespace}} @icon="org" data-test-badge-namespace />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</h1>
|
</h1>
|
||||||
</p.levelLeft>
|
</p.levelLeft>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
Copyright (c) HashiCorp, Inc.
|
Copyright (c) HashiCorp, Inc.
|
||||||
SPDX-License-Identifier: BUSL-1.1
|
SPDX-License-Identifier: BUSL-1.1
|
||||||
~}}
|
~}}
|
||||||
|
|
||||||
<ExternalLink
|
<ExternalLink
|
||||||
@href={{this.namespaceLink}}
|
@href={{this.namespaceLink}}
|
||||||
@sameTab={{true}}
|
@sameTab={{true}}
|
||||||
|
|||||||
@@ -32,6 +32,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="namespace-list {{if this.isAnimating 'animated-list'}}">
|
<div class="namespace-list {{if this.isAnimating 'animated-list'}}">
|
||||||
|
{{#if this.auth.isRootToken}}
|
||||||
|
<div class="has-left-margin-s has-right-margin-s">
|
||||||
|
<span><Icon @name="alert-triangle-fill" class="has-text-highlight" /></span>
|
||||||
|
<span class="is-size-8 has-text-semibold">
|
||||||
|
You are logged in with a root token and will have to reauthenticate when switching namespaces.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<div class="is-mobile level-left">
|
<div class="is-mobile level-left">
|
||||||
{{#unless this.isUserRootNamespace}}
|
{{#unless this.isUserRootNamespace}}
|
||||||
<NamespaceLink
|
<NamespaceLink
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
Copyright (c) HashiCorp, Inc.
|
Copyright (c) HashiCorp, Inc.
|
||||||
SPDX-License-Identifier: BUSL-1.1
|
SPDX-License-Identifier: BUSL-1.1
|
||||||
~}}
|
~}}
|
||||||
|
|
||||||
<Sidebar::Nav::Cluster />
|
<Sidebar::Nav::Cluster />
|
||||||
{{! Only show license banners for Enterprise }}
|
{{! Only show license banners for Enterprise }}
|
||||||
{{#if this.activeCluster.version.isEnterprise}}
|
{{#if this.activeCluster.version.isEnterprise}}
|
||||||
|
|||||||
Reference in New Issue
Block a user