[fix #452] redesign sign up form
This commit is contained in:
parent
6777b51331
commit
ac5c00c26f
3 changed files with 35 additions and 66 deletions
|
@ -1,4 +1,6 @@
|
||||||
class Users::RegistrationsController < Devise::RegistrationsController
|
class Users::RegistrationsController < Devise::RegistrationsController
|
||||||
|
layout "new_application"
|
||||||
|
|
||||||
# before_action :configure_sign_up_params, only: [:create]
|
# before_action :configure_sign_up_params, only: [:create]
|
||||||
# before_action :configure_account_update_params, only: [:update]
|
# before_action :configure_account_update_params, only: [:update]
|
||||||
|
|
||||||
|
|
|
@ -1,64 +1,33 @@
|
||||||
-# <h2>Sign up</h2>
|
.two-columns.auth
|
||||||
-#
|
.columns-container
|
||||||
-# <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
.column.preview
|
||||||
-# <%= devise_error_messages! %>
|
= image_tag "landing/hero/dematerialiser.svg", class: "paperless-logo"
|
||||||
-#
|
.baseline.center
|
||||||
-# <div class="field">
|
%h3 Un outil simple
|
||||||
-# <%= f.label :email %><br />
|
%p
|
||||||
-# <%= f.email_field :email, autofocus: true %>
|
pour gérer les formulaires
|
||||||
-# </div>
|
%br
|
||||||
-#
|
administratifs dématérialisés.
|
||||||
-# <div class="field">
|
|
||||||
-# <%= f.label :password %>
|
|
||||||
-# <% if @validatable %>
|
|
||||||
-# <em>(<%= @minimum_password_length %> characters minimum)</em>
|
|
||||||
-# <% end %><br />
|
|
||||||
-# <%= f.password_field :password, autocomplete: "off" %>
|
|
||||||
-# </div>
|
|
||||||
-#
|
|
||||||
-# <div class="field">
|
|
||||||
-# <%= f.label :password_confirmation %><br />
|
|
||||||
-# <%= f.password_field :password_confirmation, autocomplete: "off" %>
|
|
||||||
-# </div>
|
|
||||||
-#
|
|
||||||
-# <div class="actions">
|
|
||||||
-# <%= f.submit "Sign up" %>
|
|
||||||
-# </div>
|
|
||||||
-# <% end %>
|
|
||||||
|
|
||||||
= 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
|
= f.label :email, "Email"
|
||||||
%br
|
= f.text_field :email
|
||||||
.flag
|
|
||||||
= image_tag(image_url(LOGO_NAME))
|
|
||||||
%br
|
|
||||||
%h2#gestionnaire_login Inscription
|
|
||||||
|
|
||||||
%br
|
= f.label :password, "Mot de passe"
|
||||||
%br
|
= f.password_field :password, value: @user.password, placeholder: "8 caractères minimum"
|
||||||
#new-user
|
|
||||||
= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
|
= f.submit "Créer un compte", class: "button large primary expand"
|
||||||
%h4
|
|
||||||
= f.label :email
|
.separation.center
|
||||||
.input-group
|
ou
|
||||||
.input-group-addon
|
|
||||||
%span.fa.fa-user
|
.center
|
||||||
= f.email_field :email, class: 'form-control', placeholder: 'Email', value: params[:user_email]
|
= image_tag "login-with-fc-hover.svg", style: "display: none"
|
||||||
%br
|
= link_to "", france_connect_particulier_path, class: "login-with-fc"
|
||||||
%h4
|
|
||||||
= f.label :password, 'Mot de passe'
|
.center
|
||||||
.input-group
|
= link_to "Qu’est-ce que FranceConnect ?", "https://franceconnect.gouv.fr/", target: "_blank", class: "link"
|
||||||
.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
|
|
||||||
|
|
|
@ -4,18 +4,16 @@ describe Users::RegistrationsController, type: :controller do
|
||||||
let(:email) { 'test@octo.com' }
|
let(:email) { 'test@octo.com' }
|
||||||
let(:password) { 'password' }
|
let(:password) { 'password' }
|
||||||
|
|
||||||
let(:user) { {email: email, password: password, password_confirmation: password} }
|
let(:user) { { email: email, password: password } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@request.env["devise.mapping"] = Devise.mappings[:user]
|
@request.env["devise.mapping"] = Devise.mappings[:user]
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.create' do
|
describe '.create' do
|
||||||
subject { post :create, params: {user: user }}
|
subject { post :create, params: { user: user } }
|
||||||
|
|
||||||
context 'when user is correct' do
|
context 'when user is correct' do
|
||||||
it { expect(described_class).to be < Devise::RegistrationsController }
|
|
||||||
|
|
||||||
it 'sends welcome email' do
|
it 'sends welcome email' do
|
||||||
expect(WelcomeMailer).to receive(:welcome_email).and_return(WelcomeMailer)
|
expect(WelcomeMailer).to receive(:welcome_email).and_return(WelcomeMailer)
|
||||||
expect(WelcomeMailer).to receive(:deliver_now!)
|
expect(WelcomeMailer).to receive(:deliver_now!)
|
||||||
|
@ -38,7 +36,7 @@ describe Users::RegistrationsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user is not correct' do
|
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
|
it 'not sends welcome email' do
|
||||||
expect(WelcomeMailer).not_to receive(:welcome_email)
|
expect(WelcomeMailer).not_to receive(:welcome_email)
|
||||||
|
|
Loading…
Reference in a new issue