Files
threshold-ui/ui/desktop/app/components/settings-card/user/index.js
T
LaurenandZhihe Li 990e2d6b9d [Desktop][Bug fix]: Stop target sessions before unauthenticating user session (#2891)
* add stopAll invocation to ipc handler

* trigger modal on both signout btns

* refactor invalidateSession fn

* fix application controller tests

* fix failing tests settings-card/user

* add test to Acceptance | authentication

* migrate electron dialog.showMessageBoxSync to Hds

* rename channel and tracked prop, consolidate cancel fns

* combine modals, add willDestroy, refactor

* test signout and close sessions modal

* address feedback

* refactor window.electron in authentication-test

* address feedback

* refactor: 💡 Fix failing tests

---------

Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com>
2025-08-04 16:44:27 -04:00

52 lines
1.0 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Component from '@glimmer/component';
import { service } from '@ember/service';
export default class SettingsUserInfoComponent extends Component {
// =services
@service session;
@service intl;
// =attributes
/**
* Returns the username of the current user
* @type {string}
*/
get userInfo() {
const {
data: {
authenticated: { username },
},
} = this.session;
return username;
}
/**
* Returns true if user is authenticated
* @type {boolean}
*/
get isAuthenticated() {
const { isAuthenticated } = this.session;
return isAuthenticated;
}
/**
* Returns the type of authmethod used by the user
* @type {string}
*/
get authMethod() {
const {
data: {
authenticated: { authenticator },
},
} = this.session;
const formattedAuthenticatorType = authenticator.split(':')[1];
return this.intl.t(`resources.account.types.${formattedAuthenticatorType}`);
}
}