From 531a89945b3d2f1ee84b6241a3ed0f926b31529f Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 14 Dec 2016 13:05:42 +0100 Subject: [PATCH 1/8] member form: add asterisks on mendatory fields --- .../templates/shared/_member_form.html.erb | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/app/assets/templates/shared/_member_form.html.erb b/app/assets/templates/shared/_member_form.html.erb index f1e4683c6c..ac40d00532 100644 --- a/app/assets/templates/shared/_member_form.html.erb +++ b/app/assets/templates/shared/_member_form.html.erb @@ -55,13 +55,16 @@ ng-disabled="preventField['profile.gender'] && user.profile.gender && !userForm['user[profile_attributes][gender]'].$dirty"/> {{ 'woman' | translate }} - {{ 'gender_is_required' }} + + + {{ 'gender_is_required' }}
- + +
- +
- +
- +
- +
- +
- + @@ -181,7 +184,7 @@
- + @@ -198,7 +201,7 @@
- +
- + Date: Wed, 14 Dec 2016 15:14:33 +0100 Subject: [PATCH 2/8] sso wording --- app/assets/templates/profile/complete.html.erb | 2 +- config/locales/app.logged.en.yml | 4 ++-- config/locales/app.logged.fr.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/assets/templates/profile/complete.html.erb b/app/assets/templates/profile/complete.html.erb index 65c1b99abb..8101e158b3 100644 --- a/app/assets/templates/profile/complete.html.erb +++ b/app/assets/templates/profile/complete.html.erb @@ -28,7 +28,7 @@ {{ 'you_ve_just_created_a_new_account_on_the_fablab_by_logging_from' | translate:{ GENDER: nameGenre, NAME: fablabName }:"messageformat" }}
{{activeProvider.name}} ({{ssoEmail()}})
-

{{ 'before_letting_you_use_the_application_we_need_some_more_details' }}.

+

{{ 'we_need_some_more_details' }}.

{{ 'your_email_is_already_used_by_another_account_on_the_platform' }}

diff --git a/config/locales/app.logged.en.yml b/config/locales/app.logged.en.yml index b0195a92f8..533e1bbe7a 100644 --- a/config/locales/app.logged.en.yml +++ b/config/locales/app.logged.en.yml @@ -5,8 +5,8 @@ en: # user's profile completion page when logging from an SSO provider 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." + we_need_some_more_details: "To finalize the platform setup, we need some more details" + your_email_is_already_used_by_another_account_on_the_platform: "It looks like your email address is already used by another user. Check your email address and please input below the code sent to you." 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" diff --git a/config/locales/app.logged.fr.yml b/config/locales/app.logged.fr.yml index 84420ce1cc..ea0e901dcf 100644 --- a/config/locales/app.logged.fr.yml +++ b/config/locales/app.logged.fr.yml @@ -5,8 +5,8 @@ fr: # page de complétion du profil utilisateur, à la première connexion depuis un SSO 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." + we_need_some_more_details: "Afin de finaliser le paramétrage de la plate-forme, nous avons besoin de quelques renseignements supplémentaires" + your_email_is_already_used_by_another_account_on_the_platform: "Il semblerait que votre adresse de courriel soit déjà utilisée par un autre utilisateur. Vérifiez votre adresse électronique et veuillez saisir ci-dessous le code qui vient de vous être envoyé." 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" From a7fdc4d7414f2468d175687a89b76782b676eb9b Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 14 Dec 2016 15:55:12 +0100 Subject: [PATCH 3/8] fix potentital issue with sso + enterprise profile --- app/views/api/members/show.json.jbuilder | 2 +- db/schema.rb | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/views/api/members/show.json.jbuilder b/app/views/api/members/show.json.jbuilder index 8f061f96a5..7f417dffe4 100644 --- a/app/views/api/members/show.json.jbuilder +++ b/app/views/api/members/show.json.jbuilder @@ -30,7 +30,7 @@ json.profile do json.address do json.id @member.profile.organization.address.id json.address @member.profile.organization.address.address - end + end if @member.profile.organization.address end if @member.profile.organization end diff --git a/db/schema.rb b/db/schema.rb index f42f20eb9c..1b7f84d7f4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -289,7 +289,7 @@ t.boolean "is_read", default: false t.datetime "created_at" t.datetime "updated_at" - t.string "receiver_type" + t.string "receiver_type", limit: 255 t.boolean "is_send", default: false t.jsonb "meta_data", default: {} end @@ -320,7 +320,6 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "profile_url" - t.string "logout_endpoint" end create_table "offer_days", force: :cascade do |t| @@ -467,7 +466,7 @@ t.datetime "published_at" end - add_index "projects", ["slug"], name: "index_projects_on_slug", using: :btree + add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true, using: :btree create_table "projects_components", force: :cascade do |t| t.integer "project_id" @@ -536,8 +535,8 @@ t.datetime "updated_at" t.integer "availability_id" t.datetime "ex_start_at" - t.datetime "ex_end_at" t.datetime "canceled_at" + t.datetime "ex_end_at" t.boolean "offered", default: false end @@ -719,6 +718,7 @@ add_index "user_trainings", ["user_id"], name: "index_user_trainings_on_user_id", using: :btree create_table "users", force: :cascade do |t| + t.string "username", limit: 255 t.string "email", limit: 255, default: "", null: false t.string "encrypted_password", limit: 255, default: "", null: false t.string "reset_password_token", limit: 255 @@ -741,7 +741,6 @@ t.boolean "is_allow_contact", default: true t.integer "group_id" t.string "stp_customer_id", limit: 255 - t.string "username", limit: 255 t.string "slug", limit: 255 t.boolean "is_active", default: true t.boolean "invoicing_disabled", default: false From 5e1b85832c0f5361d418cc790b66c29b26c645bb Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 14 Dec 2016 17:14:53 +0100 Subject: [PATCH 4/8] [ongoing] resend sso fusion token --- .../{profile.coffee => profile.coffee.erb} | 26 +++++++++++++++++-- app/assets/templates/profile/_token.html.erb | 1 + .../templates/profile/resend_code_modal.html | 26 +++++++++++++++++++ config/locales/app.logged.en.yml | 3 +++ config/locales/app.logged.fr.yml | 3 +++ 5 files changed, 57 insertions(+), 2 deletions(-) rename app/assets/javascripts/controllers/{profile.coffee => profile.coffee.erb} (87%) create mode 100644 app/assets/templates/profile/resend_code_modal.html diff --git a/app/assets/javascripts/controllers/profile.coffee b/app/assets/javascripts/controllers/profile.coffee.erb similarity index 87% rename from app/assets/javascripts/controllers/profile.coffee rename to app/assets/javascripts/controllers/profile.coffee.erb index f2f542b31a..e883d8dfbe 100644 --- a/app/assets/javascripts/controllers/profile.coffee +++ b/app/assets/javascripts/controllers/profile.coffee.erb @@ -1,8 +1,8 @@ 'use strict' -Application.Controllers.controller "CompleteProfileController", ["$scope", "$rootScope", "$state", "$window", "_t", "growl", "CSRF", "Auth", "Member", "settingsPromise", "activeProviderPromise", "groupsPromise", "cguFile", "memberPromise", "Session" -, ($scope, $rootScope, $state, $window, _t, growl, CSRF, Auth, Member, settingsPromise, activeProviderPromise, groupsPromise, cguFile, memberPromise, Session) -> +Application.Controllers.controller "CompleteProfileController", ["$scope", "$rootScope", "$state", "$window", "_t", "growl", "CSRF", "Auth", "Member", "settingsPromise", "activeProviderPromise", "groupsPromise", "cguFile", "memberPromise", "Session", "dialogs" +, ($scope, $rootScope, $state, $window, _t, growl, CSRF, Auth, Member, settingsPromise, activeProviderPromise, groupsPromise, cguFile, memberPromise, Session, dialogs) -> @@ -141,6 +141,28 @@ Application.Controllers.controller "CompleteProfileController", ["$scope", "$roo + ## + # Ask for email confirmation and send the SSO merging token again + # @param $event {Object} jQuery event object + ## + $scope.resendCode = (event) -> + event.preventDefault() + event.stopPropagation() + # TODO show modal only IF email is not mapped to sso OR email = null + dialogs.confirm + templateUrl: '<%= asset_path "profile/resend_code_modal.html" %>' + resolve: + object: -> + email: memberPromise.email + , (email) -> + console.log(email) + # TODO update email + # TODO in every cases, resend email + # TODO growl result + + + + ## # Disconnect and re-connect the user to the SSO to force the synchronisation of the profile's data ## diff --git a/app/assets/templates/profile/_token.html.erb b/app/assets/templates/profile/_token.html.erb index f4a8b04049..3017b18ed1 100644 --- a/app/assets/templates/profile/_token.html.erb +++ b/app/assets/templates/profile/_token.html.erb @@ -3,6 +3,7 @@

{{ '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' }}

{{ 'just_specify_code_here_to_recover_access' }}

+

{{ 'i_did_not_receive_the_code' }}

diff --git a/app/assets/templates/profile/resend_code_modal.html b/app/assets/templates/profile/resend_code_modal.html new file mode 100644 index 0000000000..427d381ae2 --- /dev/null +++ b/app/assets/templates/profile/resend_code_modal.html @@ -0,0 +1,26 @@ + + + diff --git a/config/locales/app.logged.en.yml b/config/locales/app.logged.en.yml index 533e1bbe7a..8a5e26a31f 100644 --- a/config/locales/app.logged.en.yml +++ b/config/locales/app.logged.en.yml @@ -18,9 +18,12 @@ en: 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." + i_did_not_receive_the_code: "I didn't receive the code" 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." + send_code_again: "Send the code again" + email_format_is_incorrect: "Email format is incorrect" dashboard: # dashboard: public profile diff --git a/config/locales/app.logged.fr.yml b/config/locales/app.logged.fr.yml index ea0e901dcf..b3e8aeab5b 100644 --- a/config/locales/app.logged.fr.yml +++ b/config/locales/app.logged.fr.yml @@ -18,9 +18,12 @@ fr: 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." + i_did_not_receive_the_code: "Je n'ai pas reçu le code" 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." + send_code_again: "Renvoyer le code" + email_format_is_incorrect: "Le format de l'adresse email est incorrect" dashboard: # tableau de bord: profile publique From 102eecdc8a4d8239a57e92d12e8c259b4ebad304 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Thu, 15 Dec 2016 14:16:24 +0100 Subject: [PATCH 5/8] ability to send again auth migration code --- .../controllers/profile.coffee.erb | 15 +++++++------- .../javascripts/services/authProvider.coffee | 3 +++ .../templates/profile/resend_code_modal.html | 2 +- .../api/auth_providers_controller.rb | 20 ++++++++++++++++++- app/policies/auth_provider_policy.rb | 3 +++ config/locales/app.logged.en.yml | 2 ++ config/locales/app.logged.fr.yml | 2 ++ config/locales/en.yml | 2 ++ config/locales/fr.yml | 2 ++ config/routes.rb | 1 + 10 files changed, 42 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/controllers/profile.coffee.erb b/app/assets/javascripts/controllers/profile.coffee.erb index e883d8dfbe..781f12995f 100644 --- a/app/assets/javascripts/controllers/profile.coffee.erb +++ b/app/assets/javascripts/controllers/profile.coffee.erb @@ -1,8 +1,8 @@ 'use strict' -Application.Controllers.controller "CompleteProfileController", ["$scope", "$rootScope", "$state", "$window", "_t", "growl", "CSRF", "Auth", "Member", "settingsPromise", "activeProviderPromise", "groupsPromise", "cguFile", "memberPromise", "Session", "dialogs" -, ($scope, $rootScope, $state, $window, _t, growl, CSRF, Auth, Member, settingsPromise, activeProviderPromise, groupsPromise, cguFile, memberPromise, Session, dialogs) -> +Application.Controllers.controller "CompleteProfileController", ["$scope", "$rootScope", "$state", "$window", "_t", "growl", "CSRF", "Auth", "Member", "settingsPromise", "activeProviderPromise", "groupsPromise", "cguFile", "memberPromise", "Session", "dialogs", "AuthProvider" +, ($scope, $rootScope, $state, $window, _t, growl, CSRF, Auth, Member, settingsPromise, activeProviderPromise, groupsPromise, cguFile, memberPromise, Session, dialogs, AuthProvider) -> @@ -148,18 +148,17 @@ Application.Controllers.controller "CompleteProfileController", ["$scope", "$roo $scope.resendCode = (event) -> event.preventDefault() event.stopPropagation() - # TODO show modal only IF email is not mapped to sso OR email = null dialogs.confirm templateUrl: '<%= asset_path "profile/resend_code_modal.html" %>' resolve: object: -> email: memberPromise.email , (email) -> - console.log(email) - # TODO update email - # TODO in every cases, resend email - # TODO growl result - + # Request the server to send an auth-migration email to the current user + AuthProvider.send_code {email: email}, (res) -> + growl.info(_t('code_successfully_sent_again')) + , (err) -> + growl.error(err.data.error) diff --git a/app/assets/javascripts/services/authProvider.coffee b/app/assets/javascripts/services/authProvider.coffee index 4acb0b7312..e9928ba8f4 100644 --- a/app/assets/javascripts/services/authProvider.coffee +++ b/app/assets/javascripts/services/authProvider.coffee @@ -11,4 +11,7 @@ Application.Services.factory 'AuthProvider', ["$resource", ($resource)-> active: method: 'GET' url: '/api/auth_providers/active' + send_code: + method: 'POST' + url: '/api/auth_providers/send_code' ] diff --git a/app/assets/templates/profile/resend_code_modal.html b/app/assets/templates/profile/resend_code_modal.html index 427d381ae2..b3e04dd02d 100644 --- a/app/assets/templates/profile/resend_code_modal.html +++ b/app/assets/templates/profile/resend_code_modal.html @@ -5,7 +5,7 @@

{{ 'send_code_again' }}