chore: 🤖 add support for changing origin if unauthenticated
This commit is contained in:
1 file changed
+19
@@ -5,6 +5,7 @@ import { action } from '@ember/object';
|
||||
export default class OriginRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service session;
|
||||
@service origin;
|
||||
@service intl;
|
||||
@service notify;
|
||||
@@ -20,6 +21,24 @@ export default class OriginRoute extends Route {
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
* If arriving here already authenticated, redirect to index for further
|
||||
* processing. User must be logged out before changing the origin.
|
||||
*/
|
||||
beforeModel() {
|
||||
if (this.session.isAuthenticated) this.replaceWith('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the existing origin, if any, to the controller scope.
|
||||
* @param {Controller} controller
|
||||
*/
|
||||
setupController(controller) {
|
||||
super.setupController(...arguments);
|
||||
const origin = this.origin.rendererOrigin;
|
||||
controller.setProperties({ origin });
|
||||
}
|
||||
|
||||
/**
|
||||
* Points the API to the specified origin. When the main process receives
|
||||
* the origin, it is expected that the renderer will be restarted.
|
||||
|
||||
Reference in new issue
Block a user