mirror of
https://github.com/documize/community.git
synced 2025-07-21 22:29:41 +02:00
password changes for Documize auth provider only
This commit is contained in:
parent
0fedfb199b
commit
2c33c6443b
22 changed files with 120 additions and 64 deletions
|
@ -10,8 +10,8 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import constants from '../utils/constants';
|
import constants from '../../utils/constants';
|
||||||
import encoding from '../utils/encoding';
|
import encoding from '../../utils/encoding';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
computed
|
computed
|
|
@ -10,8 +10,9 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
import AuthProvider from '../../mixins/auth';
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend(AuthProvider, {
|
||||||
editUser: null,
|
editUser: null,
|
||||||
deleteUser: null,
|
deleteUser: null,
|
||||||
drop: null,
|
drop: null,
|
|
@ -10,6 +10,7 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
import AuthProvider from '../../mixins/auth';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isEmpty,
|
isEmpty,
|
||||||
|
@ -18,7 +19,7 @@ const {
|
||||||
get
|
get
|
||||||
} = Ember;
|
} = Ember;
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend(AuthProvider, {
|
||||||
newUser: { firstname: "", lastname: "", email: "", active: true },
|
newUser: { firstname: "", lastname: "", email: "", active: true },
|
||||||
firstnameEmpty: computed.empty('newUser.firstname'),
|
firstnameEmpty: computed.empty('newUser.firstname'),
|
||||||
lastnameEmpty: computed.empty('newUser.lastname'),
|
lastnameEmpty: computed.empty('newUser.lastname'),
|
|
@ -10,6 +10,7 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
import AuthProvider from '../mixins/auth';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
computed,
|
computed,
|
||||||
|
@ -18,7 +19,7 @@ const {
|
||||||
isPresent
|
isPresent
|
||||||
} = Ember;
|
} = Ember;
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend(AuthProvider, {
|
||||||
password: { password: "", confirmation: "" },
|
password: { password: "", confirmation: "" },
|
||||||
hasFirstnameError: computed.empty('model.firstname'),
|
hasFirstnameError: computed.empty('model.firstname'),
|
||||||
hasLastnameError: computed.empty('model.lastname'),
|
hasLastnameError: computed.empty('model.lastname'),
|
||||||
|
@ -44,6 +45,10 @@ export default Ember.Component.extend({
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
didReceiveAttrs() {
|
||||||
|
this.set
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
save() {
|
save() {
|
||||||
let password = this.get('password.password');
|
let password = this.get('password.password');
|
||||||
|
|
25
app/app/mixins/auth.js
Normal file
25
app/app/mixins/auth.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
|
||||||
|
//
|
||||||
|
// 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>.
|
||||||
|
//
|
||||||
|
// https://documize.com
|
||||||
|
|
||||||
|
import Ember from 'ember';
|
||||||
|
import constants from '../utils/constants';
|
||||||
|
|
||||||
|
export default Ember.Mixin.create({
|
||||||
|
appMeta: Ember.inject.service(),
|
||||||
|
isAuthProviderDocumize: true,
|
||||||
|
IsAuthProviderKeycloak: false,
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this._super(...arguments);
|
||||||
|
this.set('isAuthProviderDocumize', this.get('appMeta.authProvider') === constants.AuthProvider.Documize);
|
||||||
|
this.set('isAuthProviderKeycloak', this.get('appMeta.authProvider') === constants.AuthProvider.Keycloak);
|
||||||
|
}
|
||||||
|
});
|
|
@ -24,5 +24,13 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||||
controller.set('serial', this.serial);
|
controller.set('serial', this.serial);
|
||||||
controller.set('slug', this.slug);
|
controller.set('slug', this.slug);
|
||||||
controller.set('folderId', this.folderId);
|
controller.set('folderId', this.folderId);
|
||||||
|
},
|
||||||
|
|
||||||
|
activate() {
|
||||||
|
$('body').addClass('background-color-off-white');
|
||||||
|
},
|
||||||
|
|
||||||
|
deactivate() {
|
||||||
|
$('body').removeClass('background-color-off-white');
|
||||||
}
|
}
|
||||||
});
|
});
|
|
@ -11,12 +11,20 @@
|
||||||
|
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import NotifierMixin from "../../../mixins/notifier";
|
import NotifierMixin from "../../../mixins/notifier";
|
||||||
|
import constants from '../../../utils/constants';
|
||||||
|
|
||||||
export default Ember.Controller.extend(NotifierMixin, {
|
export default Ember.Controller.extend(NotifierMixin, {
|
||||||
global: Ember.inject.service(),
|
global: Ember.inject.service(),
|
||||||
appMeta: Ember.inject.service(),
|
appMeta: Ember.inject.service(),
|
||||||
session: Ember.inject.service(),
|
session: Ember.inject.service(),
|
||||||
|
|
||||||
|
handleProviderChange(data) {
|
||||||
|
this.get('session').logout();
|
||||||
|
this.set('appMeta.authProvider', data.authProvider);
|
||||||
|
this.set('appMeta.authConfig', data.authConfig);
|
||||||
|
window.location.href= '/';
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onSave(provider, config) {
|
onSave(provider, config) {
|
||||||
if(this.get('session.isGlobalAdmin')) {
|
if(this.get('session.isGlobalAdmin')) {
|
||||||
|
@ -24,11 +32,15 @@ export default Ember.Controller.extend(NotifierMixin, {
|
||||||
|
|
||||||
return this.get('global').saveAuthConfig(data).then(() => {
|
return this.get('global').saveAuthConfig(data).then(() => {
|
||||||
this.showNotification('Saved');
|
this.showNotification('Saved');
|
||||||
|
|
||||||
if (provider !== this.get('appMeta.authProvider')) {
|
if (provider !== this.get('appMeta.authProvider')) {
|
||||||
this.get('session').logout();
|
if (provider === constants.AuthProvider.Keycloak) {
|
||||||
this.set('appMeta.authProvider', provider);
|
this.get('global').syncExternalUsers().then(() => {
|
||||||
this.set('appMeta.authConfig', config);
|
this.handleProviderChange(data);
|
||||||
window.location.href= '/';
|
});
|
||||||
|
} else {
|
||||||
|
this.handleProviderChange(data);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.set('appMeta.authProvider', provider);
|
this.set('appMeta.authProvider', provider);
|
||||||
this.set('appMeta.authConfig', config);
|
this.set('appMeta.authConfig', config);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{{auth-settings authProvider=model.authProvider authConfig=model.authConfig onSave=(action 'onSave') onSync=(action 'onSync')}}
|
{{customize/auth-settings authProvider=model.authProvider authConfig=model.authConfig onSave=(action 'onSave') onSync=(action 'onSync')}}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{{general-settings model=model save=(action 'save')}}
|
{{customize/general-settings model=model save=(action 'save')}}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{{global-settings model=model saveSMTP=(action 'saveSMTP') saveLicense=(action 'saveLicense')}}
|
{{customize/global-settings model=model saveSMTP=(action 'saveSMTP') saveLicense=(action 'saveLicense')}}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{user-settings add=(action 'add')}}
|
{{customize/user-settings add=(action 'add')}}
|
||||||
|
|
||||||
<div class="clearfix" />
|
<div class="clearfix" />
|
||||||
|
|
||||||
{{settings/user-list users=model onDelete=(action "onDelete") onSave=(action "onSave") onPassword=(action "onPassword")}}
|
{{customize/user-list users=model onDelete=(action "onDelete") onSave=(action "onSave") onPassword=(action "onPassword")}}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
.onboarding-container
|
.onboarding-container {
|
||||||
{
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
color: $color-off-black;
|
color: $color-off-black;
|
||||||
|
|
|
@ -91,6 +91,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{#if isAuthProviderDocumize}}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="input-control">
|
<div class="input-control">
|
||||||
|
@ -107,6 +108,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
21
app/app/templates/components/customize/user-settings.hbs
Normal file
21
app/app/templates/components/customize/user-settings.hbs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{{#if isAuthProviderDocumize}}
|
||||||
|
<form class="form-bordered">
|
||||||
|
<div class="form-header">
|
||||||
|
<div class="title">Add user</div>
|
||||||
|
<div class="tip">New users receive an invitation email with a random password</div>
|
||||||
|
</div>
|
||||||
|
<div class="input-control">
|
||||||
|
<label>Firstname</label>
|
||||||
|
{{focus-input id="newUserFirstname" type="text" value=newUser.firstname class=(if hasFirstnameEmptyError 'error')}}
|
||||||
|
</div>
|
||||||
|
<div class="input-control">
|
||||||
|
<label>Lastname</label>
|
||||||
|
{{input id="newUserLastname" type="text" value=newUser.lastname class=(if hasLastnameEmptyError 'error')}}
|
||||||
|
</div>
|
||||||
|
<div class="input-control">
|
||||||
|
<label>Email</label>
|
||||||
|
{{input id="newUserEmail" type="text" value=newUser.email class=(if hasEmailEmptyError 'error')}}
|
||||||
|
</div>
|
||||||
|
<div class="regular-button button-blue" {{ action 'add' }}>Add</div>
|
||||||
|
</form>
|
||||||
|
{{/if}}
|
|
@ -4,7 +4,6 @@
|
||||||
<img class="logo" src="/assets/img/logo-color.png"/>
|
<img class="logo" src="/assets/img/logo-color.png"/>
|
||||||
|
|
||||||
<div class="stage-1">
|
<div class="stage-1">
|
||||||
<h2>Documize Sign-up</h2>
|
|
||||||
<p>Let's set up your account</p>
|
<p>Let's set up your account</p>
|
||||||
<div class="input-control">
|
<div class="input-control">
|
||||||
<label>Firstname</label>
|
<label>Firstname</label>
|
||||||
|
@ -13,11 +12,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="input-control">
|
<div class="input-control">
|
||||||
<label>Lastname</label>
|
<label>Lastname</label>
|
||||||
<div class="tip">To customize the app for you</div>
|
<div class="tip">What the government calls you</div>
|
||||||
<input id="stage-1-lastname" type="text" value="" />
|
<input id="stage-1-lastname" type="text" value="" />
|
||||||
</div>
|
</div>
|
||||||
<div class="input-control">
|
<div class="input-control">
|
||||||
<div id="stage-1-next" class="regular-button button-green">Next ›</div>
|
<div id="stage-1-next" class="regular-button button-green">Next →</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -34,7 +33,7 @@
|
||||||
<input id="stage-2-password-confirm" type="password" value="" />
|
<input id="stage-2-password-confirm" type="password" value="" />
|
||||||
</div>
|
</div>
|
||||||
<div class="input-control">
|
<div class="input-control">
|
||||||
<div id="stage-2-next" class="regular-button button-green">Sign In ›</div>
|
<div id="stage-2-next" class="regular-button button-green">Sign In →</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<label>Email</label>
|
<label>Email</label>
|
||||||
{{input id="email" type="text" value=model.email class=(if hasEmailError 'error')}}
|
{{input id="email" type="text" value=model.email class=(if hasEmailError 'error')}}
|
||||||
</div>
|
</div>
|
||||||
|
{{#if isAuthProviderDocumize}}
|
||||||
<div class="input-control">
|
<div class="input-control">
|
||||||
<label>Password</label>
|
<label>Password</label>
|
||||||
<div class="tip">Optional change your password</div>
|
<div class="tip">Optional change your password</div>
|
||||||
|
@ -25,5 +26,6 @@
|
||||||
<div class="tip">Confirm your new password</div>
|
<div class="tip">Confirm your new password</div>
|
||||||
{{input id="confirmPassword" type="password" value=password.confirmation class=hasConfirmPasswordError}}
|
{{input id="confirmPassword" type="password" value=password.confirmation class=hasConfirmPasswordError}}
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
<div class="regular-button button-blue" {{ action 'save' }}>save</div>
|
<div class="regular-button button-blue" {{ action 'save' }}>save</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
<form class="form-bordered">
|
|
||||||
<div class="form-header">
|
|
||||||
<div class="title">Add user</div>
|
|
||||||
<div class="tip">New users receive an invitation email with a random password</div>
|
|
||||||
</div>
|
|
||||||
<div class="input-control">
|
|
||||||
<label>Firstname</label>
|
|
||||||
{{focus-input id="newUserFirstname" type="text" value=newUser.firstname class=(if hasFirstnameEmptyError 'error')}}
|
|
||||||
</div>
|
|
||||||
<div class="input-control">
|
|
||||||
<label>Lastname</label>
|
|
||||||
{{input id="newUserLastname" type="text" value=newUser.lastname class=(if hasLastnameEmptyError 'error')}}
|
|
||||||
</div>
|
|
||||||
<div class="input-control">
|
|
||||||
<label>Email</label>
|
|
||||||
{{input id="newUserEmail" type="text" value=newUser.email class=(if hasEmailEmptyError 'error')}}
|
|
||||||
</div>
|
|
||||||
<div class="regular-button button-blue" {{ action 'add' }}>Add</div>
|
|
||||||
</form>
|
|
Loading…
Add table
Add a link
Reference in a new issue