1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-28 09:39:42 +02:00

keycloak forgot password handling

This commit is contained in:
Harvey Kandola 2017-03-21 12:09:13 +00:00
parent 2c33c6443b
commit e5119dd243
3 changed files with 31 additions and 14 deletions

View file

@ -10,10 +10,27 @@
// https://documize.com // https://documize.com
import Ember from 'ember'; import Ember from 'ember';
import constants from '../../../utils/constants';
export default Ember.Route.extend({ 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) { setupController(controller, model) {
controller.set('model', model); controller.set('model', model);
controller.set('sayThanks', false); controller.set('sayThanks', false);
},
activate() {
$('body').addClass('background-color-off-white');
},
deactivate() {
$('body').removeClass('background-color-off-white');
} }
}); });

View file

@ -10,13 +10,13 @@
// https://documize.com // https://documize.com
import Ember from 'ember'; 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'), appMeta: Ember.inject.service('app-meta'),
invalidCredentials: false,
session: Ember.inject.service('session'), session: Ember.inject.service('session'),
audit: Ember.inject.service('audit'), audit: Ember.inject.service('audit'),
invalidCredentials: false,
reset() { reset() {
this.setProperties({ this.setProperties({
@ -28,15 +28,13 @@ export default Ember.Controller.extend({
if (dbhash.length > 0 && dbhash !== "{{.DBhash}}") { if (dbhash.length > 0 && dbhash !== "{{.DBhash}}") {
this.transitionToRoute('setup'); this.transitionToRoute('setup');
} }
}, },
actions: { actions: {
login() { login() {
let creds = this.getProperties('email', 'password'); let creds = this.getProperties('email', 'password');
this.get('session').authenticate('authenticator:documize', creds) this.get('session').authenticate('authenticator:documize', creds).then((response) => {
.then((response) => {
this.get('audit').record("logged-in"); this.get('audit').record("logged-in");
this.transitionToRoute('folders'); this.transitionToRoute('folders');
return response; return response;

View file

@ -18,7 +18,9 @@
<button type="submit" class="regular-button button-blue">Sign in</button> <button type="submit" class="regular-button button-blue">Sign in</button>
<span class="{{unless invalidCredentials "hide"}} color-red margin-left-20">Invalid credentials</span> <span class="{{unless invalidCredentials "hide"}} color-red margin-left-20">Invalid credentials</span>
</div> </div>
{{#if isAuthProviderDocumize}}
{{#link-to 'auth.forgot'}}Forgot your password?{{/link-to}} {{#link-to 'auth.forgot'}}Forgot your password?{{/link-to}}
{{/if}}
</form> </form>
</div> </div>
</div> </div>