1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-02 20:15:26 +02:00

working on forentend

This commit is contained in:
Derek Chen 2019-08-08 00:40:03 +08:00
parent 9d6b6fec23
commit 8c99977fc9
10 changed files with 130 additions and 5 deletions

View file

@ -12,10 +12,12 @@
import { inject as service } from '@ember/service';
import AuthProvider from '../../../mixins/auth';
import Controller from '@ember/controller';
import {Promise as EmberPromise} from "rsvp";
export default Controller.extend(AuthProvider, {
appMeta: service('app-meta'),
session: service('session'),
invalidCredentials: false,
reset() {
@ -26,7 +28,7 @@ export default Controller.extend(AuthProvider, {
});
}
if (this.get('isAuthProviderLDAP')) {
if (this.get('isAuthProviderLDAP') || this.get('isAuthProviderCAS')) {
this.setProperties({
username: '',
password: ''
@ -62,6 +64,24 @@ export default Controller.extend(AuthProvider, {
this.set('invalidCredentials', true);
});
}
// if (this.get('isAuthProviderCAS')) {
//
// this.get('session').authenticate('authenticator:cas').then((response) => {
// this.transitionToRoute('folders');
// return response;
// }).catch(() => {
// this.set('invalidCredentials', true);
// });
// }
},
loginWithCAS(){
// let config = this.get('config');
let url = 'https://sso.bangdao-tech.com/sso/login?service=' + encodeURIComponent('https://duty.bangdao-tech.com/');
window.location.replace(url);
}
}
});

View file

@ -17,6 +17,7 @@ import Route from '@ember/routing/route';
export default Route.extend({
appMeta: service(),
kcAuth: service(),
global: service(),
localStorage: service(),
showLogin: false,

View file

@ -27,8 +27,12 @@
{{input type="password" value=password id="authPassword" class="form-control" autocomplete="current-password"}}
{{/if}}
</div>
{{#if isAuthProviderCAS}}
{{ui/ui-button color=constants.Color.Green light=true label=constants.Label.SignIn onClick=(action "loginWithCAS")}}
{{else}}
{{ui/ui-button color=constants.Color.Green light=true label=constants.Label.SignIn onClick=(action "login")}}
{{/if}}
{{ui/ui-button color=constants.Color.Green light=true label=constants.Label.SignIn onClick=(action "login")}}
<div class="{{unless invalidCredentials "invisible"}} color-red-600 mt-3">Invalid credentials</div>
{{#if isAuthProviderDocumize}}

View file

@ -42,6 +42,8 @@ export default Route.extend(AuthenticatedRouteMixin, {
case constants.AuthProvider.LDAP:
data.authConfig = config;
break;
case constants.AuthProvider.CAS:
data.authConfig = config;
case constants.AuthProvider.Documize:
data.authConfig = '';
break;

View file

@ -1,6 +1,6 @@
{{layout/logo-heading
title="Authentication"
desc="Choose user authentication provider — Documize, Redhat Keycloak, LDAP/AD"
desc="Choose user authentication provider — Documize, Redhat Keycloak, LDAP/AD, CAS"
icon=constants.Icon.Locked}}
{{customize/auth-settings