1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

change interface for SSO/email already used

This commit is contained in:
Sylvain 2016-04-25 14:30:03 +02:00
parent 0ee36ca022
commit b4ad735d7f
8 changed files with 134 additions and 78 deletions

View File

@ -1,8 +1,8 @@
'use strict'
Application.Controllers.controller "CompleteProfileController", ["$scope", "$rootScope", "$state", "_t", "growl", "CSRF", "Auth", "Member", "settingsPromise", "activeProviderPromise", "groupsPromise", "cguFile", "memberPromise"
, ($scope, $rootScope, $state, _t, growl, CSRF, Auth, Member, settingsPromise, activeProviderPromise, groupsPromise, cguFile, memberPromise) ->
Application.Controllers.controller "CompleteProfileController", ["$scope", "$rootScope", "$state", "_t", "growl", "CSRF", "Auth", "Member", "settingsPromise", "activeProviderPromise", "groupsPromise", "cguFile", "memberPromise", "Session"
, ($scope, $rootScope, $state, _t, growl, CSRF, Auth, Member, settingsPromise, activeProviderPromise, groupsPromise, cguFile, memberPromise, Session) ->
@ -83,6 +83,8 @@ Application.Controllers.controller "CompleteProfileController", ["$scope", "$roo
$rootScope.currentUser = content
$state.go('app.public.home')
##
# For use with 'ng-class', returns the CSS class name for the uploads previews.
# The preview may show a placeholder or the content of the file depending on the upload state.
@ -112,6 +114,8 @@ Application.Controllers.controller "CompleteProfileController", ["$scope", "$roo
growl.error(_t('an_unexpected_error_occurred_check_your_authentication_code'))
console.error(err)
##
# Return the email given by the SSO provider, parsed if needed
# @return {String} E-mail of the current user
@ -124,6 +128,8 @@ Application.Controllers.controller "CompleteProfileController", ["$scope", "$roo
return duplicate[1]
email
##
# Test if the user's mail is marked as duplicate
# @return {boolean}
@ -131,7 +137,21 @@ Application.Controllers.controller "CompleteProfileController", ["$scope", "$roo
$scope.hasDuplicate = ->
email = memberPromise.email
if email
return (email.match(/^<([^>]+)>.{20}-duplicate$/) == null)
return !(email.match(/^<([^>]+)>.{20}-duplicate$/) == null)
##
# Disconnect and re-connect the user to the SSO to force the synchronisation of the profile's data
##
$scope.syncProfile = ->
Auth.logout().then (oldUser) ->
Session.destroy()
$rootScope.currentUser = null
$rootScope.toCheckNotifications = false
$scope.notifications = []
$window.location.href = activeProviderPromise.link_to_sso_connect
### PRIVATE SCOPE ###

View File

@ -98,6 +98,8 @@ p, .widget p {
.text-u-l, .underline {text-decoration: underline;}
.text-c { text-transform: capitalize; }
.text-italic { font-style: italic; }
.text-center { text-align: center; }
.text-active, .active > .text, .active > .auto .text{display: none !important;}

View File

@ -1,7 +1,8 @@
<section class="panel panel-default bg-token m-lg">
<div class="panel-body m-r">
<h3 translate>{{ 'do_you_already_have_an_account' }}</h3>
<p translate>{{ 'do_not_fill_the_form_beside_but_specify_here_the_code_you_ve_received_by_email_to_recover_your_access' }}</p>
<p ng-hide="hasDuplicate()" translate>{{ 'do_not_fill_the_form_beside_but_specify_here_the_code_you_ve_received_by_email_to_recover_your_access' }}</p>
<p ng-show="hasDuplicate()" translate>{{ 'just_specify_code_here_to_recover_access' }}</p>
<div class="row">
<div class="col-sm-3 col-sm-offset-1"></div>
<div class="col-sm-offset-1 col-sm-6">

View File

@ -28,7 +28,8 @@
{{ 'you_ve_just_created_a_new_account_on_the_fablab_by_logging_from' | translate:{ GENDER: nameGenre, NAME: fablabName }:"messageformat" }}<br/>
<img class="m-l v-middle" height="16" width="16" src='https://www.google.com/s2/favicons?domain={{activeProvider.domain}}' />
<strong class="v-middle">{{activeProvider.name}} <span ng-if="ssoEmail()">({{ssoEmail()}})</span></strong><br/>
<p class="m-t-md">{{ 'before_letting_you_use_the_application_we_need_some_more_details' | translate }}.</p>
<p class="m-t-md" ng-hide="hasDuplicate()" translate>{{ 'before_letting_you_use_the_application_we_need_some_more_details' }}.</p>
<p class="m-t-md" ng-show="hasDuplicate()" translate>{{ 'your_email_is_already_used_by_another_account_on_the_platform' }}</p>
</div>
</section>
</div>
@ -42,75 +43,99 @@
</div>
<div class="row">
<div class="col-md-6">
<div class="m-lg panel panel-default bg-light pos-rlt">
<div ng-class="{'disabling-overlay' : !!user.auth_token}">
<div class="panel-body">
<h3 translate>{{ 'new_on_this_platform' }}</h3>
<p translate>{{ 'please_fill_the_following_form'}}.</p>
<p>{{ 'some_data_may_have_already_been_provided_by_provider_and_cannot_be_modified' | translate:{NAME:activeProvider.name} }}.<br/>
{{ 'then_click_on_' | translate }} <strong translate>{{ 'confirm_changes' }}</strong> {{ '_to_start_using_the_application' | translate }}.</p>
</div>
<form role="form"
name="userForm"
class="form-horizontal"
action="{{ actionUrl }}"
ng-upload="submited(content)"
upload-options-enable-rails-csrf="true"
novalidate>
<div class="m-lg panel panel-default bg-light pos-rlt" ng-hide="hasDuplicate()">
<div ng-class="{'disabling-overlay' : !!user.auth_token}">
<div class="panel-body">
<h3 translate>{{ 'new_on_this_platform' }}</h3>
<p translate>{{ 'please_fill_the_following_form'}}.</p>
<p>{{ 'some_data_may_have_already_been_provided_by_provider_and_cannot_be_modified' | translate:{NAME:activeProvider.name} }}.<br/>
{{ 'then_click_on_' | translate }} <strong translate>{{ 'confirm_changes' }}</strong> {{ '_to_start_using_the_application' | translate }}.</p>
</div>
<form role="form"
name="userForm"
class="form-horizontal"
action="{{ actionUrl }}"
ng-upload="submited(content)"
upload-options-enable-rails-csrf="true"
novalidate>
<section>
<section>
<div class="panel-body m-r">
<!-- common fields -->
<ng-include src="'<%= asset_path 'shared/_member_form.html' %>'"></ng-include>
<div class="panel-body m-r">
<!-- common fields -->
<ng-include src="'<%= asset_path 'shared/_member_form.html' %>'"></ng-include>
<div class="row">
<div class="col-sm-3 col-sm-offset-1"></div>
<div class="col-sm-offset-1 col-sm-6">
<!-- group -->
<div class="form-group" ng-class="{'has-error': userForm['user[group_id]'].$dirty && userForm['user[group_id]'].$invalid}">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-users"></i></span>
<select ng-model="user.group_id" class="form-control" name="user[group_id]" required>
<option value=null translate>{{ 'your_user_s_profile' }}</option>
<option ng-repeat="group in groups" value="{{group.id}}" ng-selected="group.id == user.group_id">{{group.name}}</option>
</select>
<div class="row">
<div class="col-sm-3 col-sm-offset-1"></div>
<div class="col-sm-offset-1 col-sm-6">
<!-- group -->
<div class="form-group" ng-class="{'has-error': userForm['user[group_id]'].$dirty && userForm['user[group_id]'].$invalid}">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-users"></i></span>
<select ng-model="user.group_id" class="form-control" name="user[group_id]" required>
<option value=null translate>{{ 'your_user_s_profile' }}</option>
<option ng-repeat="group in groups" value="{{group.id}}" ng-selected="group.id == user.group_id">{{group.name}}</option>
</select>
</div>
<span class="help-block" ng-show="userForm['user[group_id]'].$dirty && userForm['user[group_id]'].$error.required" translate>{{ 'user_s_profile_is_required' }}</span>
</div>
<span class="help-block" ng-show="userForm['user[group_id]'].$dirty && userForm['user[group_id]'].$error.required" translate>{{ 'user_s_profile_is_required' }}</span>
</div>
<!-- allow contact-->
<div class="form-group" ng-class="{'has-error': userForm['user[is_allow_contact]'].$dirty && userForm['user[is_allow_contact]'].$invalid}">
<input type="checkbox"
name="user[is_allow_contact]"
ng-model="user.is_allow_contact"
value="true"/> {{ 'i_authorize_Fablab_users_registered_on_the_site_to_contact_me' | translate }}
</div>
<!-- allow contact-->
<div class="form-group" ng-class="{'has-error': userForm['user[is_allow_contact]'].$dirty && userForm['user[is_allow_contact]'].$invalid}">
<input type="checkbox"
name="user[is_allow_contact]"
ng-model="user.is_allow_contact"
value="true"/> {{ 'i_authorize_Fablab_users_registered_on_the_site_to_contact_me' | translate }}
</div>
<!-- accept cgu -->
<div class="form-group" ng-class="{'has-error': userForm.cgu.$dirty && userForm.cgu.$invalid}" ng-show="cgu">
<input type="checkbox"
name="cgu"
ng-model="user.cgu"
value="true"
ng-required="cgu != null"/> {{ 'i_ve_read_and_i_accept_' | translate }} <a href="{{cgu.custom_asset_file_attributes.attachment_url}}" target="_blank" translate>{{ '_the_fablab_policy' }}</a>
<!-- accept cgu -->
<div class="form-group" ng-class="{'has-error': userForm.cgu.$dirty && userForm.cgu.$invalid}" ng-show="cgu">
<input type="checkbox"
name="cgu"
ng-model="user.cgu"
value="true"
ng-required="cgu != null"/> {{ 'i_ve_read_and_i_accept_' | translate }} <a href="{{cgu.custom_asset_file_attributes.attachment_url}}" target="_blank" translate>{{ '_the_fablab_policy' }}</a>
</div>
</div>
</div>
</div> <!-- ./panel-body -->
<div class="panel-footer no-padder">
<input type="submit"
value="{{ 'confirm_changes' | translate }}"
class="r-b btn-valid btn btn-warning btn-block p-lg btn-lg text-u-c"
ng-disabled="userForm.$invalid"/>
</div>
</div> <!-- ./panel-body -->
<div class="panel-footer no-padder">
<input type="submit"
value="{{ 'confirm_changes' | translate }}"
class="r-b btn-valid btn btn-warning btn-block p-lg btn-lg text-u-c"
ng-disabled="userForm.$invalid"/>
</div>
</section>
</form>
</div>
</section>
</form>
</div>
</div>
<section class="m-lg panel panel-default bg-light pos-rlt" ng-show="hasDuplicate()">
<div ng-class="{'disabling-overlay' : !!user.auth_token}">
<div class="panel-body">
<h3 translate>{{ 'new_on_this_platform' }}</h3>
<p class="text-italic">
{{ 'your_email_' | translate }} <strong>({{ssoEmail()}})</strong> {{ '_is_currently_associated_with_another_account_on_this_platform' | translate }}
{{ 'please_click_to_change_email_associated_with_your_PROVIDER_account' | translate:{PROVDER: activeProvider.name} }}
</p>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<a class="btn btn-default" ng-href="{{activeProvider.link_to_sso_profile}}" target="_blank">
<i class="fa fa-edit"></i> {{ 'change_my_data' | translate }}
</a>
<p class="text-italic">{{ 'once_your_data_are_up_to_date_' | translate }} <strong translate>{{ '_click_on_the_synchronization_button_opposite_' }}</strong> {{ 'or' | translate}} <strong translate>{{ '_disconnect_then_reconnect_' }}</strong> {{ '_for_your_changes_to_take_effect' | translate }}</p>
</div>
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<a class="btn btn-default" ng-click="syncProfile()">
<i class="fa fa-refresh"></i> {{ 'sync_my_profile' | translate }}
</a>
</div>
</div>
</div>
</div>
</section>
</div>
<div class="col-md-6" ng-hide="user.merged_at">
<ng-include src="'<%= asset_path 'profile/_token.html' %>'"></ng-include>

View File

@ -6,13 +6,18 @@ en:
confirm_your_new_account: "Confirm your new account"
you_ve_just_created_a_new_account_on_the_fablab_by_logging_from: "You've just created a new account on the {NAME}, by logging from" # messageFormat interpolation
before_letting_you_use_the_application_we_need_some_more_details: "Before letting you use the application, we need some more details"
your_email_is_already_used_by_another_account_on_the_platform: "But wait, there is a problem! Your email is already used by another account on the platform."
please_fill_the_following_form: "Please fill the following form"
some_data_may_have_already_been_provided_by_provider_and_cannot_be_modified: "Some data may have already been provided by {{NAME}} and cannot be modified" # angular interpolation
then_click_on_: "Then click on"
_to_start_using_the_application: "to start using the application"
new_on_this_platform: "New on this platform?"
your_email_: "Your email"
_is_currently_associated_with_another_account_on_this_platform: "is currently associated with another account on this platform."
please_click_to_change_email_associated_with_your_PROVIDER_account: "If it is not yours, please click on the following button to change the email associated with your {{PROVIDER}} account." # angular interpolation
do_you_already_have_an_account: "Do you already have an account?"
do_not_fill_the_form_beside_but_specify_here_the_code_you_ve_received_by_email_to_recover_your_access: "Do not fill the form beside but specify here the code you've received by email, to recover your access"
just_specify_code_here_to_recover_access: "Just specify here the code you've received by email to recover your access."
authentification_code: "Authentification code"
confirm_my_code: "Confirm my code"
an_unexpected_error_occurred_check_your_authentication_code: "An unexpected error occurred, please check your authentication code."
@ -33,13 +38,6 @@ en:
no_labels: "No labels"
delete_my_account: "Delete my account"
edit_my_profile: "Edit my profile"
change_my_data: "Change my data"
once_your_data_are_up_to_date_: "Once your data are up to date,"
_click_on_the_synchronization_button_opposite_: "click on the synchronization button opposite"
_or_: 'or'
_disconnect_then_reconnect_: "disconnect then reconnect"
_for_your_changes_to_take_effect: "for your changes to take effect."
sync_my_profile: "Sync my profile"
your_group_has_been_successfully_changed: "Your group has been successfully changed."
an_unexpected_error_prevented_your_group_from_being_changed: "An unexpected error prevented your group from being changed."
do_you_really_want_to_delete_your_account: "Do you really want to delete your account?"

View File

@ -6,13 +6,18 @@ fr:
confirm_your_new_account: "Confirmez votre nouveau compte"
you_ve_just_created_a_new_account_on_the_fablab_by_logging_from: "Vous venez de créer un nouveau compte sur {GENDER, select, male{le} female{la} other{les}} {NAME}, en vous connectant depuis" # messageFormat interpolation
before_letting_you_use_the_application_we_need_some_more_details: "Avant de vous laisser utiliser l'application, nous avons besoin de quelques renseignements supplémentaires"
your_email_is_already_used_by_another_account_on_the_platform: "Mais attendez, il y a un problème ! Votre adresse de courriel est déjà utilisée par un autre compte sur cette plate-forme."
please_fill_the_following_form: "Merci de compléter le formulaire suivant"
some_data_may_have_already_been_provided_by_provider_and_cannot_be_modified: "Certaines informations peuvent nous avoir été déjà fournies par {{NAME}} et ne sont pas modifiables" # angular interpolation
then_click_on_: "Cliquez ensuite sur"
_to_start_using_the_application: "pour commencer à utiliser l'application"
new_on_this_platform: "Nouveau sur cette plate-forme ?"
your_email_: "Votre adresse de courriel"
_is_currently_associated_with_another_account_on_this_platform: "est actuellement associée avec un autre compte sur cette plate-forme."
please_click_to_change_email_associated_with_your_PROVIDER_account: "Si ce n'est pas le vôtre, merci de cliquer sur le bouton ci-dessous pour changer l'adresse de courriel associée avec votre compte {{PROVIDER}}." # angular interpolation
do_you_already_have_an_account: "Vous possédez déjà un compte ?"
do_not_fill_the_form_beside_but_specify_here_the_code_you_ve_received_by_email_to_recover_your_access: "Ne remplissez pas le formulaire à gauche mais indiquez ici le code qui vous a été fourni par e-mail, cela vous permettra de récupérer l'accès à votre compte."
just_specify_code_here_to_recover_access: "Indiquez simplement ici le code que vous avez reçu par e-mail, cela vous permettra de récupérer l'accès à votre compte."
authentification_code: "Code d'authentification"
confirm_my_code: "Valider mon code"
an_unexpected_error_occurred_check_your_authentication_code: "Une erreur inattendue est survenue, vérifiez votre code d'authentification."
@ -33,13 +38,6 @@ fr:
no_labels: "Aucune étiquette"
delete_my_account: "Supprimer mon compte"
edit_my_profile: "Éditer votre profil"
change_my_data: "Modifier mes données"
once_your_data_are_up_to_date_: "Une fois vos données à jour,"
_click_on_the_synchronization_button_opposite_: "cliquez sur le bouton de synchronisation ci-contre"
_or_: 'ou'
_disconnect_then_reconnect_: "déconnectez-vous puis re-connectez vous"
_for_your_changes_to_take_effect: "pour que les modifications soient prises en compte."
sync_my_profile: "Synchroniser mon profil"
your_group_has_been_successfully_changed: "Votre groupe a bien été changé."
an_unexpected_error_prevented_your_group_from_being_changed: "Une erreur inattendue a empêché votre changement de groupe."
do_you_really_want_to_delete_your_account: "Êtes-vous sûr de vouloir supprimer votre compte ?"

View File

@ -80,6 +80,12 @@ en:
to_date: "to" # context: date. eg: "from 01/01 to 01/05"
to_time: "to" # context: time. eg. "from 18:00 to 21:00"
or: "or"
change_my_data: "Change my data"
sync_my_profile: "Sync my profile"
once_your_data_are_up_to_date_: "Once your data are up to date,"
_click_on_the_synchronization_button_opposite_: "click on the synchronization button opposite"
_disconnect_then_reconnect_: "disconnect then reconnect"
_for_your_changes_to_take_effect: "for your changes to take effect."
messages:
you_will_lose_any_unsaved_modification_if_you_quit_this_page: "You will lose any unsaved modification if you quit this page"

View File

@ -80,6 +80,12 @@ fr:
to_date: "au" # context: date. eg: "from 01/01 to 01/05"
to_time: "à" # context: time. eg. "from 18:00 to 21:00"
or: "ou"
change_my_data: "Modifier mes données"
sync_my_profile: "Synchroniser mon profil"
once_your_data_are_up_to_date_: "Une fois vos données à jour,"
_click_on_the_synchronization_button_opposite_: "cliquez sur le bouton de synchronisation ci-contre"
_disconnect_then_reconnect_: "déconnectez-vous puis re-connectez vous"
_for_your_changes_to_take_effect: "pour que les modifications soient prises en compte."
messages:
you_will_lose_any_unsaved_modification_if_you_quit_this_page: "Vous perdrez les modifications non enregistrées si vous quittez cette page"