1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 07:39:43 +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

@ -33,6 +33,9 @@ export default Component.extend(ModalMixin, Notifier, {
isLDAPProvider: computed('authProvider', function() {
return this.get('authProvider') === this.get('constants').AuthProvider.LDAP;
}),
isCASProvider: computed('authProvider', function(){
return this.get('authProvider') === this.get('constants').AuthProvider.CAS;
}),
KeycloakUrlError: empty('keycloakConfig.url'),
KeycloakRealmError: empty('keycloakConfig.realm'),
@ -61,6 +64,10 @@ export default Component.extend(ModalMixin, Notifier, {
ldapPreview: null,
ldapConfig: null,
casErrorUrl: empty('casConfig.url'),
casErrorRedirectUrl: empty('casConfig.redirectUrl'),
casConfig:null,
init() {
this._super(...arguments);
@ -122,6 +129,19 @@ export default Component.extend(ModalMixin, Notifier, {
this.set('ldapConfig', ldapConfig);
break;
}
case constants.AuthProvider.CAS: {
let casConfig = this.get('authConfig');
if (_.isUndefined(casConfig) || _.isNull(casConfig) || _.isEmpty(casConfig) ) {
casConfig = {};
} else {
casConfig = JSON.parse(casConfig);
casConfig.url = casConfig.hasOwnProperty('url') ? casConfig.url : '';
casConfig.redirectUrl = casConfig.hasOwnProperty('redirectUrl') ? casConfig.redirectUrl : '';
}
this.set('casConfig', casConfig);
break;
}
}
},
@ -140,6 +160,10 @@ export default Component.extend(ModalMixin, Notifier, {
let constants = this.get('constants');
this.set('authProvider', constants.AuthProvider.LDAP);
},
onCAS() {
let constants = this.get('constants');
this.set('authProvider', constants.AuthProvider.CAS);
},
onLDAPEncryption(e) {
this.set('ldapConfig.encryptionType', e);
@ -231,6 +255,21 @@ export default Component.extend(ModalMixin, Notifier, {
return;
}
break;
case constants.AuthProvider.CAS:
if (this.get('casErrorUrl')) {
$("#cas-url").focus();
return;
}
if (this.get('casErrorRedirectUrl')) {
$("#cas-redirect-url").focus();
return;
}
config = copy(this.get('casConfig'));
config.url = config.url.trim();
config.redirectUrl = config.redirectUrl.trim();
break;
}