diff --git a/app/app/pods/auth/forgot/route.js b/app/app/pods/auth/forgot/route.js index 29a86781..7be1b877 100644 --- a/app/app/pods/auth/forgot/route.js +++ b/app/app/pods/auth/forgot/route.js @@ -10,10 +10,27 @@ // https://documize.com import Ember from 'ember'; +import constants from '../../../utils/constants'; export default Ember.Route.extend({ + appMeta: Ember.inject.service(), + + beforeModel() { + if (this.get('appMeta.authProvider') === constants.AuthProvider.Keycloak) { + this.transitionTo('auth.login'); + } + }, + setupController(controller, model) { controller.set('model', model); controller.set('sayThanks', false); - } + }, + + activate() { + $('body').addClass('background-color-off-white'); + }, + + deactivate() { + $('body').removeClass('background-color-off-white'); + } }); \ No newline at end of file diff --git a/app/app/pods/auth/login/controller.js b/app/app/pods/auth/login/controller.js index 9768df7a..c593cd55 100644 --- a/app/app/pods/auth/login/controller.js +++ b/app/app/pods/auth/login/controller.js @@ -10,13 +10,13 @@ // https://documize.com import Ember from 'ember'; -// import constants from '../../../utils/constants'; +import AuthProvider from '../../../mixins/auth'; -export default Ember.Controller.extend({ +export default Ember.Controller.extend(AuthProvider, { appMeta: Ember.inject.service('app-meta'), - invalidCredentials: false, session: Ember.inject.service('session'), audit: Ember.inject.service('audit'), + invalidCredentials: false, reset() { this.setProperties({ @@ -28,21 +28,19 @@ export default Ember.Controller.extend({ if (dbhash.length > 0 && dbhash !== "{{.DBhash}}") { this.transitionToRoute('setup'); } - }, actions: { login() { let creds = this.getProperties('email', 'password'); - this.get('session').authenticate('authenticator:documize', creds) - .then((response) => { - this.get('audit').record("logged-in"); - this.transitionToRoute('folders'); - return response; - }).catch(() => { - this.set('invalidCredentials', true); - }); + this.get('session').authenticate('authenticator:documize', creds).then((response) => { + this.get('audit').record("logged-in"); + this.transitionToRoute('folders'); + return response; + }).catch(() => { + this.set('invalidCredentials', true); + }); } } }); diff --git a/app/app/pods/auth/login/template.hbs b/app/app/pods/auth/login/template.hbs index 7f342bd1..5b3ef006 100644 --- a/app/app/pods/auth/login/template.hbs +++ b/app/app/pods/auth/login/template.hbs @@ -18,7 +18,9 @@ Invalid credentials - {{#link-to 'auth.forgot'}}Forgot your password?{{/link-to}} + {{#if isAuthProviderDocumize}} + {{#link-to 'auth.forgot'}}Forgot your password?{{/link-to}} + {{/if}}