mirror of
https://github.com/fleetbase/fleetbase.git
synced 2026-01-08 07:16:49 +00:00
* Tweaked: few styling improvements * Added: view label functions to customer portal components * Added: bulk dispatch * Fixed: route caching by generating and providing unique name via Fleetbase `RESTRegistrar` * Implemented: impersonation feature for system admin * Fixed: mail settings for smtp and added support for mailgun, sendgrid, postmark and resend * Removed: model cache * Improved test email HTML * Added: self hosted instance extension install instructions * Improved: Webhooks UI
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import { tracked } from '@glimmer/tracking';
|
|
import { inject as service } from '@ember/service';
|
|
import { action } from '@ember/object';
|
|
import { later } from '@ember/runloop';
|
|
|
|
export default class ImpersonatorTrayComponent extends Component {
|
|
@service session;
|
|
@service notifications;
|
|
@service router;
|
|
@service fetch;
|
|
|
|
get isImpersonator() {
|
|
return typeof this.session.data?.authenticated?.impersonator === 'string';
|
|
}
|
|
|
|
/**
|
|
* Restore session
|
|
*
|
|
* @memberof ConsoleAdminOrganizationsIndexUsersController
|
|
*/
|
|
@action async restoreSession() {
|
|
try {
|
|
const { token } = await this.fetch.delete('auth/impersonate');
|
|
await this.router.transitionTo('console');
|
|
this.session.manuallyAuthenticate(token);
|
|
this.notifications.info(`Ending impersonation session.`);
|
|
later(
|
|
this,
|
|
() => {
|
|
window.location.reload();
|
|
},
|
|
600
|
|
);
|
|
} catch (error) {
|
|
this.notifications.serverError(error);
|
|
}
|
|
}
|
|
}
|