* fix: 🐛 properly show username for oidc auth method in user menu * test: 💍 fix admin ui tests * test: 💍 fix desktop ui tests * refactor: 💡 admin to not store username in authenticated object * refactor: 💡 use getter in app controller * test: 💍 POC for how we could update our tests to use auth account * refactor: 💡 remove unused service * test: 💍 fix all tests in ui/admin * test: 💍 revert one change * refactor: 💡 update ui/desktop w/ feedback + fix tests * refactor: 💡 add in error handling * refactor: 💡 cleanup unused service * test: 💍 fix e2e test selector ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17231
40 lines
847 B
JavaScript
40 lines
847 B
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 true if user is authenticated
|
|
* @type {boolean}
|
|
*/
|
|
get isAuthenticated() {
|
|
const { isAuthenticated } = this.session;
|
|
return isAuthenticated;
|
|
}
|
|
|
|
/**
|
|
* Returns the type of auth-method 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}`);
|
|
}
|
|
}
|