[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
|
||||
layout "new_application"
|
||||
|
||||
# before_action :configure_sign_up_params, only: [:create]
|
||||
# before_action :configure_account_update_params, only: [:update]
|
||||
|
||||
|
|
|
@ -1,64 +1,33 @@
|
|||
-# <h2>Sign up</h2>
|
||||
-#
|
||||
-# <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
||||
-# <%= devise_error_messages! %>
|
||||
-#
|
||||
-# <div class="field">
|
||||
-# <%= f.label :email %><br />
|
||||
-# <%= f.email_field :email, autofocus: true %>
|
||||
-# </div>
|
||||
-#
|
||||
-# <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 %>
|
||||
.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"
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue