mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
PRovide LDAP sync and authentication
This commit is contained in:
parent
63b17f9b88
commit
074eea3aeb
38 changed files with 567 additions and 499 deletions
|
@ -10,11 +10,11 @@
|
|||
// https://documize.com
|
||||
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
import Controller from '@ember/controller';
|
||||
|
||||
export default Controller.extend({
|
||||
userService: service('user'),
|
||||
appMeta: service('app-meta'),
|
||||
|
||||
actions: {
|
||||
forgot: function (email) {
|
||||
|
|
|
@ -19,7 +19,7 @@ export default Route.extend({
|
|||
beforeModel() {
|
||||
let constants = this.get('constants');
|
||||
|
||||
if (this.get('appMeta.authProvider') === constants.AuthProvider.Keycloak) {
|
||||
if (this.get('appMeta.authProvider') !== constants.AuthProvider.Documize) {
|
||||
this.transitionTo('auth.login');
|
||||
}
|
||||
},
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<div class="auth-box">
|
||||
<div class="logo">
|
||||
<img src="/assets/img/logo-purple.png" title="Documize" alt="Documize" class="img-fluid" />
|
||||
<div class="url">Authenticate with {{appMeta.appHost}}</div>
|
||||
</div>
|
||||
<div class="login-form">
|
||||
{{forgot-password forgot=(action 'forgot')}}
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
// https://documize.com
|
||||
|
||||
import { inject as service } from '@ember/service';
|
||||
import Controller from '@ember/controller';
|
||||
import AuthProvider from '../../../mixins/auth';
|
||||
import Controller from '@ember/controller';
|
||||
|
||||
export default Controller.extend(AuthProvider, {
|
||||
appMeta: service('app-meta'),
|
||||
|
@ -19,10 +19,19 @@ export default Controller.extend(AuthProvider, {
|
|||
invalidCredentials: false,
|
||||
|
||||
reset() {
|
||||
this.setProperties({
|
||||
email: '',
|
||||
password: ''
|
||||
});
|
||||
if (this.get('sAuthProviderDocumize')) {
|
||||
this.setProperties({
|
||||
email: '',
|
||||
password: ''
|
||||
});
|
||||
}
|
||||
|
||||
if (this.get('sAuthProviderLDAP')) {
|
||||
this.setProperties({
|
||||
username: '',
|
||||
password: ''
|
||||
});
|
||||
}
|
||||
|
||||
let dbhash = document.head.querySelector("[property=dbhash]").content;
|
||||
if (dbhash.length > 0 && dbhash !== "{{.DBhash}}") {
|
||||
|
@ -32,14 +41,27 @@ export default Controller.extend(AuthProvider, {
|
|||
|
||||
actions: {
|
||||
login() {
|
||||
let creds = this.getProperties('email', 'password');
|
||||
if (this.get('isAuthProviderDocumize')) {
|
||||
let creds = this.getProperties('email', 'password');
|
||||
|
||||
this.get('session').authenticate('authenticator:documize', creds).then((response) => {
|
||||
this.transitionToRoute('folders');
|
||||
return response;
|
||||
}).catch(() => {
|
||||
this.set('invalidCredentials', true);
|
||||
});
|
||||
this.get('session').authenticate('authenticator:documize', creds).then((response) => {
|
||||
this.transitionToRoute('folders');
|
||||
return response;
|
||||
}).catch(() => {
|
||||
this.set('invalidCredentials', true);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.get('isAuthProviderLDAP')) {
|
||||
let creds = this.getProperties('username', 'password');
|
||||
|
||||
this.get('session').authenticate('authenticator:ldap', creds).then((response) => {
|
||||
this.transitionToRoute('folders');
|
||||
return response;
|
||||
}).catch(() => {
|
||||
this.set('invalidCredentials', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -3,22 +3,27 @@
|
|||
<div class="auth-box">
|
||||
<div class="logo">
|
||||
<img src="/assets/img/logo-purple.png" title="Documize" alt="Documize" class="img-fluid" />
|
||||
<div class="url">Authenticate with {{appMeta.appHost}}</div>
|
||||
</div>
|
||||
<form {{action 'login' on="submit"}}>
|
||||
<div class="form-group">
|
||||
<label for="authEmail">Email</label>
|
||||
{{focus-input type="email" value=email id="authEmail" class="form-control mousetrap" placeholder="" autocomplete="username email"}}
|
||||
{{#if isAuthProviderDocumize}}
|
||||
<label for="authEmail">Email</label>
|
||||
{{focus-input type="email" value=email id="authEmail" class="form-control mousetrap" placeholder="" autocomplete="username email"}}
|
||||
{{/if}}
|
||||
{{#if isAuthProviderLDAP}}
|
||||
<label for="authUsername">Network Username</label>
|
||||
{{focus-input type="text" value=username id="authUsername" class="form-control mousetrap" placeholder="network domain username" autocomplete="username"}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="authPassword">Password</label>
|
||||
{{input type="password" value=password id="authPassword" class="form-control" autocomplete="current-password"}}
|
||||
{{input type="password" value=password id="authPassword" class="form-control" placeholder="network password" autocomplete="current-password"}}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success font-weight-bold text-uppercase mt-4">Sign in</button>
|
||||
<div class="{{unless invalidCredentials "invisible"}} color-red mt-3">Invalid credentials</div>
|
||||
{{#if isAuthProviderDocumize}}
|
||||
<div class="mt-5">
|
||||
{{#link-to 'auth.forgot'}}Forgot your password?{{/link-to}}
|
||||
</div>
|
||||
{{#link-to 'auth.forgot'}}Forgot your password?{{/link-to}}
|
||||
{{/if}}
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
// https://documize.com
|
||||
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
import Route from '@ember/routing/route';
|
||||
// import config from 'documize/config/environment';
|
||||
|
||||
export default Route.extend({
|
||||
session: service(),
|
||||
|
@ -20,15 +18,6 @@ export default Route.extend({
|
|||
|
||||
activate: function () {
|
||||
this.get('session').invalidate().then(() => {
|
||||
// if (config.environment === 'test') {
|
||||
// this.transitionTo('auth.login');
|
||||
// } else {
|
||||
// if (this.get("appMeta.allowAnonymousAccess")) {
|
||||
// this.transitionTo('folders');
|
||||
// } else {
|
||||
// this.transitionTo('auth.login');
|
||||
// }
|
||||
// }
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
// https://documize.com
|
||||
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
import Controller from '@ember/controller';
|
||||
|
||||
export default Controller.extend({
|
||||
userService: service('user'),
|
||||
appMeta: service('app-meta'),
|
||||
password: "",
|
||||
passwordConfirm: "",
|
||||
mustMatch: false,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<div class="auth-box">
|
||||
<div class="logo">
|
||||
<img src="/assets/img/logo-purple.png" title="Documize" alt="Documize" class="img-fluid" />
|
||||
<div class="url">Authenticate with {{appMeta.appHost}}</div>
|
||||
</div>
|
||||
{{password-reset reset=(action 'reset')}}
|
||||
</div>
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||
//
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// This software (Documize Community Edition) is licensed under
|
||||
// GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
//
|
||||
// You can operate outside the AGPL restrictions by purchasing
|
||||
// Documize Enterprise Edition and obtaining a commercial license
|
||||
// by contacting <sales@documize.com>.
|
||||
// by contacting <sales@documize.com>.
|
||||
//
|
||||
// https://documize.com
|
||||
|
||||
import $ from 'jquery';
|
||||
import { inject as service } from '@ember/service';
|
||||
import Route from '@ember/routing/route';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default Route.extend(AuthenticatedRouteMixin, {
|
||||
session: service(),
|
||||
|
@ -42,5 +42,5 @@ export default Route.extend(AuthenticatedRouteMixin, {
|
|||
|
||||
deactivate() {
|
||||
$('body').removeClass('background-color-off-white');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue