Enable password reset for Gestionnaires
This commit is contained in:
parent
5c2902bda5
commit
f58f9d27d9
6 changed files with 94 additions and 3 deletions
32
app/controllers/gestionnaires/passwords_controller.rb
Normal file
32
app/controllers/gestionnaires/passwords_controller.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
class Gestionnaires::PasswordsController < Devise::PasswordsController
|
||||
# GET /resource/password/new
|
||||
# def new
|
||||
# super
|
||||
# end
|
||||
|
||||
# POST /resource/password
|
||||
# def create
|
||||
# super
|
||||
# end
|
||||
|
||||
# GET /resource/password/edit?reset_password_token=abcdef
|
||||
# def edit
|
||||
# super
|
||||
# end
|
||||
|
||||
# PUT /resource/password
|
||||
# def update
|
||||
# super
|
||||
# end
|
||||
|
||||
# protected
|
||||
|
||||
# def after_resetting_password_path_for(resource)
|
||||
# super(resource)
|
||||
# end
|
||||
|
||||
# The path used after sending reset password instructions
|
||||
# def after_sending_reset_password_instructions_path_for(resource_name)
|
||||
# super(resource_name)
|
||||
# end
|
||||
end
|
31
app/views/gestionnaires/passwords/edit.html.haml
Normal file
31
app/views/gestionnaires/passwords/edit.html.haml
Normal file
|
@ -0,0 +1,31 @@
|
|||
= devise_error_messages!
|
||||
|
||||
#form_login
|
||||
= image_tag('logo-tps.png')
|
||||
%br
|
||||
%h2#gestionnaire_login Changement de mot de passe
|
||||
|
||||
%br
|
||||
%br
|
||||
#new_user
|
||||
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
|
||||
= f.hidden_field :reset_password_token
|
||||
%h4
|
||||
= f.label 'Nouveau mot de passe'
|
||||
|
||||
.input-group
|
||||
.input-group-addon
|
||||
%span.glyphicon.glyphicon-asterisk
|
||||
= f.password_field :password, autofocus: true, autocomplete: "off", class: 'form-control'
|
||||
%br
|
||||
%h4
|
||||
= f.label 'Retaper le mot de passe'
|
||||
.input-group
|
||||
.input-group-addon
|
||||
%span.glyphicon.glyphicon-asterisk
|
||||
= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control'
|
||||
%br
|
||||
%br
|
||||
.actions
|
||||
= f.submit "Changer", class:'btn btn-primary'
|
||||
%br
|
22
app/views/gestionnaires/passwords/new.html.haml
Normal file
22
app/views/gestionnaires/passwords/new.html.haml
Normal file
|
@ -0,0 +1,22 @@
|
|||
= devise_error_messages!
|
||||
|
||||
#form_login
|
||||
= image_tag('logo-tps.png')
|
||||
%br
|
||||
%h2#gestionnaire_login Mot de passe oublié
|
||||
|
||||
%br
|
||||
%br
|
||||
#new_user
|
||||
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
|
||||
%h4
|
||||
= f.label :email
|
||||
.input-group
|
||||
.input-group-addon
|
||||
%span.glyphicon.glyphicon-user
|
||||
= f.email_field :email, class: 'form-control', placeholder: 'Email'
|
||||
%br
|
||||
%br
|
||||
.actions
|
||||
= f.submit "Renvoyer", class:'btn btn-primary'
|
||||
%br
|
|
@ -25,4 +25,5 @@
|
|||
%br
|
||||
.actions
|
||||
= f.submit "Se connecter", class:'btn btn-primary'
|
||||
%br
|
||||
%br
|
||||
= render "gestionnaires/shared/links"
|
||||
|
|
2
app/views/gestionnaires/shared/_links.html.erb
Normal file
2
app/views/gestionnaires/shared/_links.html.erb
Normal file
|
@ -0,0 +1,2 @@
|
|||
<%= link_to "Mot de passe oublié ?", new_password_path(resource_name) %><br />
|
||||
|
|
@ -9,8 +9,9 @@ Rails.application.routes.draw do
|
|||
}, skip: [:password, :registrations]
|
||||
|
||||
devise_for :gestionnaires, controllers: {
|
||||
sessions: 'gestionnaires/sessions'
|
||||
}, skip: [:password, :registrations]
|
||||
sessions: 'gestionnaires/sessions',
|
||||
passwords: 'gestionnaires/passwords'
|
||||
}, skip: [:registrations]
|
||||
|
||||
devise_for :users, controllers: {
|
||||
sessions: 'users/sessions',
|
||||
|
@ -25,6 +26,8 @@ Rails.application.routes.draw do
|
|||
|
||||
devise_scope :gestionnaire do
|
||||
get '/gestionnaires/sign_in/demo' => 'gestionnaires/sessions#demo'
|
||||
get '/gestionnaires/edit' => 'gestionnaires/registrations#edit', :as => 'edit_gestionnaires_registration'
|
||||
put '/gestionnaires' => 'gestionnaires/registrations#update', :as => 'gestionnaires_registration'
|
||||
end
|
||||
|
||||
devise_scope :administrateur do
|
||||
|
|
Loading…
Reference in a new issue