diff --git a/app/assets/stylesheets/new_design/login.scss b/app/assets/stylesheets/new_design/auth.scss similarity index 88% rename from app/assets/stylesheets/new_design/login.scss rename to app/assets/stylesheets/new_design/auth.scss index 109c7b675..6f292b928 100644 --- a/app/assets/stylesheets/new_design/login.scss +++ b/app/assets/stylesheets/new_design/auth.scss @@ -2,21 +2,21 @@ @import "placeholders"; @import "mixins"; -$login-breakpoint: 820px; +$auth-breakpoint: 820px; -@media (max-width: $login-breakpoint) { +@media (max-width: $auth-breakpoint) { .preview { display: none; } - .two-columns .column.login-form { + .two-columns .column.auth-form { @include horizontal-padding(0); width: 100%; } } -@media (max-width: $login-breakpoint) { - .two-columns.login { +@media (max-width: $auth-breakpoint) { + .two-columns.auth { background: #FFFFFF; } } @@ -58,7 +58,7 @@ $login-breakpoint: 820px; } } -.login-form { +.auth-form { font-size: 14px; .reset-password { diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 1a231b900..3de89b1cd 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,4 +1,6 @@ class Users::RegistrationsController < Devise::RegistrationsController + layout "new_application" + # before_action :configure_sign_up_params, only: [:create] # before_action :configure_account_update_params, only: [:update] diff --git a/app/views/users/registrations/new.html.haml b/app/views/users/registrations/new.html.haml index a81def70b..fcaf254d6 100644 --- a/app/views/users/registrations/new.html.haml +++ b/app/views/users/registrations/new.html.haml @@ -1,64 +1,33 @@ --#

Sign up

--# --# <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> --# <%= devise_error_messages! %> --# --#
--# <%= f.label :email %>
--# <%= f.email_field :email, autofocus: true %> --#
--# --#
--# <%= f.label :password %> --# <% if @validatable %> --# (<%= @minimum_password_length %> characters minimum) --# <% end %>
--# <%= f.password_field :password, autocomplete: "off" %> --#
--# --#
--# <%= f.label :password_confirmation %>
--# <%= f.password_field :password_confirmation, autocomplete: "off" %> --#
--# --#
--# <%= f.submit "Sign up" %> --#
--# <% end %> +.two-columns.auth + .columns-container + .column.preview + = image_tag "landing/hero/dematerialiser.svg", class: "paperless-logo" + .baseline.center + %h3 Un outil simple + %p + pour gérer les formulaires + %br + administratifs dématérialisés. -= devise_error_messages! + .column.auth-form + = devise_error_messages! + = form_for User.new, url: user_registration_path, html: { class: "form" } do |f| + %h1 Créez-vous un compte -#form-login - %br - .flag - = image_tag(image_url(LOGO_NAME)) - %br - %h2#gestionnaire_login Inscription + = f.label :email, "Email" + = f.text_field :email - %br - %br - #new-user - = form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| - %h4 - = f.label :email - .input-group - .input-group-addon - %span.fa.fa-user - = f.email_field :email, class: 'form-control', placeholder: 'Email', value: params[:user_email] - %br - %h4 - = f.label :password, 'Mot de passe' - .input-group - .input-group-addon - %span.fa.fa-asterisk - = f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: 'Mot de passe' - %br - .input-group - .input-group-addon - %span.fa.fa-asterisk - = f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: 'Répeter le mot de passe' - %br - %br - .actions - = f.submit "S'enregistrer", class: 'btn btn-primary' - %br + = f.label :password, "Mot de passe" + = f.password_field :password, value: @user.password, placeholder: "8 caractères minimum" + + = f.submit "Créer un compte", class: "button large primary expand" + + .separation.center + ou + + .center + = image_tag "login-with-fc-hover.svg", style: "display: none" + = link_to "", france_connect_particulier_path, class: "login-with-fc" + + .center + = link_to "Qu’est-ce que FranceConnect ?", "https://franceconnect.gouv.fr/", target: "_blank", class: "link" diff --git a/app/views/users/sessions/new.html.haml b/app/views/users/sessions/new.html.haml index 93e0aa480..ffac4fae9 100644 --- a/app/views/users/sessions/new.html.haml +++ b/app/views/users/sessions/new.html.haml @@ -1,4 +1,4 @@ -.two-columns.login +.two-columns.auth .columns-container .column.preview - unless @dossier @@ -22,7 +22,7 @@ %p.procedure-description = h @dossier.procedure.description.html_safe - .column.login-form + .column.auth-form = form_for @user, url: user_session_path, html: { class: "form" } do |f| %h1 Connectez-vous diff --git a/spec/controllers/france_connect/particulier_controller_spec.rb b/spec/controllers/france_connect/particulier_controller_spec.rb index c0a6857b3..279f7b9ef 100644 --- a/spec/controllers/france_connect/particulier_controller_spec.rb +++ b/spec/controllers/france_connect/particulier_controller_spec.rb @@ -13,7 +13,7 @@ describe FranceConnect::ParticulierController, type: :controller do let(:user_info) { Hashie::Mash.new(france_connect_particulier_id: france_connect_particulier_id, given_name: given_name, family_name: family_name, birthdate: birthdate, birthplace: birthplace, gender: gender, email: email, password: password) } - describe '.login' do + describe '.auth' do it 'redirect to france connect serveur' do get :login expect(response.status).to eq(302) diff --git a/spec/controllers/users/registrations_controller_spec.rb b/spec/controllers/users/registrations_controller_spec.rb index 324995ca3..dd7d1add8 100644 --- a/spec/controllers/users/registrations_controller_spec.rb +++ b/spec/controllers/users/registrations_controller_spec.rb @@ -4,18 +4,16 @@ describe Users::RegistrationsController, type: :controller do let(:email) { 'test@octo.com' } let(:password) { 'password' } - let(:user) { {email: email, password: password, password_confirmation: password} } + let(:user) { { email: email, password: password } } before do @request.env["devise.mapping"] = Devise.mappings[:user] end describe '.create' do - subject { post :create, params: {user: user }} + subject { post :create, params: { user: user } } context 'when user is correct' do - it { expect(described_class).to be < Devise::RegistrationsController } - it 'sends welcome email' do expect(WelcomeMailer).to receive(:welcome_email).and_return(WelcomeMailer) expect(WelcomeMailer).to receive(:deliver_now!) @@ -38,7 +36,7 @@ describe Users::RegistrationsController, type: :controller do end context 'when user is not correct' do - let(:user) { {email: '', password: password, password_confirmation: password} } + let(:user) { { email: '', password: password } } it 'not sends welcome email' do expect(WelcomeMailer).not_to receive(:welcome_email)