diff --git a/app/app/components/auth-settings.js b/app/app/components/customize/auth-settings.js similarity index 97% rename from app/app/components/auth-settings.js rename to app/app/components/customize/auth-settings.js index 62a5d176..e5f296da 100644 --- a/app/app/components/auth-settings.js +++ b/app/app/components/customize/auth-settings.js @@ -10,8 +10,8 @@ // https://documize.com import Ember from 'ember'; -import constants from '../utils/constants'; -import encoding from '../utils/encoding'; +import constants from '../../utils/constants'; +import encoding from '../../utils/encoding'; const { computed diff --git a/app/app/components/general-settings.js b/app/app/components/customize/general-settings.js similarity index 100% rename from app/app/components/general-settings.js rename to app/app/components/customize/general-settings.js diff --git a/app/app/components/global-settings.js b/app/app/components/customize/global-settings.js similarity index 100% rename from app/app/components/global-settings.js rename to app/app/components/customize/global-settings.js diff --git a/app/app/components/settings/user-list.js b/app/app/components/customize/user-list.js similarity index 97% rename from app/app/components/settings/user-list.js rename to app/app/components/customize/user-list.js index 32bc4a25..568d8762 100644 --- a/app/app/components/settings/user-list.js +++ b/app/app/components/customize/user-list.js @@ -10,8 +10,9 @@ // https://documize.com import Ember from 'ember'; +import AuthProvider from '../../mixins/auth'; -export default Ember.Component.extend({ +export default Ember.Component.extend(AuthProvider, { editUser: null, deleteUser: null, drop: null, diff --git a/app/app/components/user-settings.js b/app/app/components/customize/user-settings.js similarity index 94% rename from app/app/components/user-settings.js rename to app/app/components/customize/user-settings.js index 593d608f..b32a6663 100644 --- a/app/app/components/user-settings.js +++ b/app/app/components/customize/user-settings.js @@ -10,6 +10,7 @@ // https://documize.com import Ember from 'ember'; +import AuthProvider from '../../mixins/auth'; const { isEmpty, @@ -18,7 +19,7 @@ const { get } = Ember; -export default Ember.Component.extend({ +export default Ember.Component.extend(AuthProvider, { newUser: { firstname: "", lastname: "", email: "", active: true }, firstnameEmpty: computed.empty('newUser.firstname'), lastnameEmpty: computed.empty('newUser.lastname'), diff --git a/app/app/components/user-profile.js b/app/app/components/user-profile.js index 4fd4ee31..02677076 100644 --- a/app/app/components/user-profile.js +++ b/app/app/components/user-profile.js @@ -10,6 +10,7 @@ // https://documize.com import Ember from 'ember'; +import AuthProvider from '../mixins/auth'; const { computed, @@ -18,7 +19,7 @@ const { isPresent } = Ember; -export default Ember.Component.extend({ +export default Ember.Component.extend(AuthProvider, { password: { password: "", confirmation: "" }, hasFirstnameError: computed.empty('model.firstname'), hasLastnameError: computed.empty('model.lastname'), @@ -44,6 +45,10 @@ export default Ember.Component.extend({ } }), + didReceiveAttrs() { + this.set + }, + actions: { save() { let password = this.get('password.password'); diff --git a/app/app/mixins/auth.js b/app/app/mixins/auth.js new file mode 100644 index 00000000..9679bb49 --- /dev/null +++ b/app/app/mixins/auth.js @@ -0,0 +1,25 @@ +// Copyright 2016 Documize Inc. . 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 . +// +// 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); + } +}); \ No newline at end of file diff --git a/app/app/pods/auth/share/route.js b/app/app/pods/auth/share/route.js index 5cdf7cec..9ad175d1 100644 --- a/app/app/pods/auth/share/route.js +++ b/app/app/pods/auth/share/route.js @@ -24,5 +24,13 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { controller.set('serial', this.serial); controller.set('slug', this.slug); controller.set('folderId', this.folderId); - } + }, + + activate() { + $('body').addClass('background-color-off-white'); + }, + + deactivate() { + $('body').removeClass('background-color-off-white'); + } }); \ No newline at end of file diff --git a/app/app/pods/customize/auth/controller.js b/app/app/pods/customize/auth/controller.js index d703bde0..a05a979b 100644 --- a/app/app/pods/customize/auth/controller.js +++ b/app/app/pods/customize/auth/controller.js @@ -11,12 +11,20 @@ import Ember from 'ember'; import NotifierMixin from "../../../mixins/notifier"; +import constants from '../../../utils/constants'; export default Ember.Controller.extend(NotifierMixin, { global: Ember.inject.service(), appMeta: 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: { onSave(provider, config) { if(this.get('session.isGlobalAdmin')) { @@ -24,11 +32,15 @@ export default Ember.Controller.extend(NotifierMixin, { return this.get('global').saveAuthConfig(data).then(() => { this.showNotification('Saved'); + if (provider !== this.get('appMeta.authProvider')) { - this.get('session').logout(); - this.set('appMeta.authProvider', provider); - this.set('appMeta.authConfig', config); - window.location.href= '/'; + if (provider === constants.AuthProvider.Keycloak) { + this.get('global').syncExternalUsers().then(() => { + this.handleProviderChange(data); + }); + } else { + this.handleProviderChange(data); + } } else { this.set('appMeta.authProvider', provider); this.set('appMeta.authConfig', config); diff --git a/app/app/pods/customize/auth/template.hbs b/app/app/pods/customize/auth/template.hbs index 4a9fff03..12e35073 100644 --- a/app/app/pods/customize/auth/template.hbs +++ b/app/app/pods/customize/auth/template.hbs @@ -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')}} diff --git a/app/app/pods/customize/general/template.hbs b/app/app/pods/customize/general/template.hbs index 908dc47e..38558ce5 100644 --- a/app/app/pods/customize/general/template.hbs +++ b/app/app/pods/customize/general/template.hbs @@ -1 +1 @@ -{{general-settings model=model save=(action 'save')}} +{{customize/general-settings model=model save=(action 'save')}} diff --git a/app/app/pods/customize/global/template.hbs b/app/app/pods/customize/global/template.hbs index 0ea61f38..72899e83 100644 --- a/app/app/pods/customize/global/template.hbs +++ b/app/app/pods/customize/global/template.hbs @@ -1 +1 @@ -{{global-settings model=model saveSMTP=(action 'saveSMTP') saveLicense=(action 'saveLicense')}} +{{customize/global-settings model=model saveSMTP=(action 'saveSMTP') saveLicense=(action 'saveLicense')}} diff --git a/app/app/pods/customize/users/template.hbs b/app/app/pods/customize/users/template.hbs index d8b084c5..ca0be522 100644 --- a/app/app/pods/customize/users/template.hbs +++ b/app/app/pods/customize/users/template.hbs @@ -1,5 +1,5 @@ -{{user-settings add=(action 'add')}} +{{customize/user-settings add=(action 'add')}}
-{{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")}} diff --git a/app/app/styles/view/page-onboard.scss b/app/app/styles/view/page-onboard.scss index 4aa30cd7..226c118d 100644 --- a/app/app/styles/view/page-onboard.scss +++ b/app/app/styles/view/page-onboard.scss @@ -1,5 +1,4 @@ -.onboarding-container -{ +.onboarding-container { width: 100%; text-align: left; color: $color-off-black; diff --git a/app/app/templates/components/auth-settings.hbs b/app/app/templates/components/customize/auth-settings.hbs similarity index 100% rename from app/app/templates/components/auth-settings.hbs rename to app/app/templates/components/customize/auth-settings.hbs diff --git a/app/app/templates/components/general-settings.hbs b/app/app/templates/components/customize/general-settings.hbs similarity index 100% rename from app/app/templates/components/general-settings.hbs rename to app/app/templates/components/customize/general-settings.hbs diff --git a/app/app/templates/components/global-settings.hbs b/app/app/templates/components/customize/global-settings.hbs similarity index 100% rename from app/app/templates/components/global-settings.hbs rename to app/app/templates/components/customize/global-settings.hbs diff --git a/app/app/templates/components/settings/user-list.hbs b/app/app/templates/components/customize/user-list.hbs similarity index 87% rename from app/app/templates/components/settings/user-list.hbs rename to app/app/templates/components/customize/user-list.hbs index d7671138..3361fa59 100644 --- a/app/app/templates/components/settings/user-list.hbs +++ b/app/app/templates/components/customize/user-list.hbs @@ -91,22 +91,24 @@
-
-
-
- -
Optional new password
- {{input id="edit-password" type="password" value=password.password}} + {{#if isAuthProviderDocumize}} +
+
+
+ +
Optional new password
+ {{input id="edit-password" type="password" value=password.password}} +
+
+
+
+ +
Confirm new password
+ {{input id="edit-confirmPassword" type="password" value=password.confirmation}} +
-
-
- -
Confirm new password
- {{input id="edit-confirmPassword" type="password" value=password.confirmation}} -
-
-
+ {{/if}}
diff --git a/app/app/templates/components/customize/user-settings.hbs b/app/app/templates/components/customize/user-settings.hbs new file mode 100644 index 00000000..b2dcbc40 --- /dev/null +++ b/app/app/templates/components/customize/user-settings.hbs @@ -0,0 +1,21 @@ +{{#if isAuthProviderDocumize}} +
+
+
Add user
+
New users receive an invitation email with a random password
+
+
+ + {{focus-input id="newUserFirstname" type="text" value=newUser.firstname class=(if hasFirstnameEmptyError 'error')}} +
+
+ + {{input id="newUserLastname" type="text" value=newUser.lastname class=(if hasLastnameEmptyError 'error')}} +
+
+ + {{input id="newUserEmail" type="text" value=newUser.email class=(if hasEmailEmptyError 'error')}} +
+
Add
+
+{{/if}} \ No newline at end of file diff --git a/app/app/templates/components/onboard/share-folder.hbs b/app/app/templates/components/onboard/share-folder.hbs index ace49dbe..87aa1f85 100644 --- a/app/app/templates/components/onboard/share-folder.hbs +++ b/app/app/templates/components/onboard/share-folder.hbs @@ -4,7 +4,6 @@
-

Documize Sign-up

Let's set up your account

@@ -13,11 +12,11 @@
-
To customize the app for you
+
What the government calls you
-
Next ›
+
Next →
@@ -34,7 +33,7 @@
-
Sign In ›
+
Sign In →
diff --git a/app/app/templates/components/user-profile.hbs b/app/app/templates/components/user-profile.hbs index e69094de..28241270 100644 --- a/app/app/templates/components/user-profile.hbs +++ b/app/app/templates/components/user-profile.hbs @@ -15,15 +15,17 @@ {{input id="email" type="text" value=model.email class=(if hasEmailError 'error')}} -
- -
Optional change your password
- {{input id="password" type="password" value=password.password class=hasPasswordError}} -
-
- -
Confirm your new password
- {{input id="confirmPassword" type="password" value=password.confirmation class=hasConfirmPasswordError}} -
+ {{#if isAuthProviderDocumize}} +
+ +
Optional change your password
+ {{input id="password" type="password" value=password.password class=hasPasswordError}} +
+
+ +
Confirm your new password
+ {{input id="confirmPassword" type="password" value=password.confirmation class=hasConfirmPasswordError}} +
+ {{/if}}
save
diff --git a/app/app/templates/components/user-settings.hbs b/app/app/templates/components/user-settings.hbs deleted file mode 100644 index db5e8c2b..00000000 --- a/app/app/templates/components/user-settings.hbs +++ /dev/null @@ -1,19 +0,0 @@ -
-
-
Add user
-
New users receive an invitation email with a random password
-
-
- - {{focus-input id="newUserFirstname" type="text" value=newUser.firstname class=(if hasFirstnameEmptyError 'error')}} -
-
- - {{input id="newUserLastname" type="text" value=newUser.lastname class=(if hasLastnameEmptyError 'error')}} -
-
- - {{input id="newUserEmail" type="text" value=newUser.email class=(if hasEmailEmptyError 'error')}} -
-
Add
-