Demo sign_in page for users and gestionnaires

This commit is contained in:
Xavier J 2016-02-15 17:13:16 +01:00
parent a20daa2ea2
commit 419f74948a
5 changed files with 26 additions and 8 deletions

View file

@ -1,5 +1,8 @@
class Gestionnaires::SessionsController < Sessions::SessionsController
def demo
@gestionnaire = Gestionnaire.new(email: 'gestionnaire@apientreprise.fr', password: 'password')
render 'new'
end
def new
@gestionnaire = Gestionnaire.new

View file

@ -1,10 +1,16 @@
class Users::SessionsController < Sessions::SessionsController
# before_filter :configure_sign_in_params, only: [:create]
def demo
@user = User.new(email: 'demo@tps.fr', password: 'password')
render 'new'
end
# GET /resource/sign_in
# def new
# super
# end
def new
@user = User.new
end
#POST /resource/sign_in
def create
@ -13,7 +19,7 @@ class Users::SessionsController < Sessions::SessionsController
current_user.update_attributes(loged_in_with_france_connect: '')
end
# DELETE /resource/sign_out
# DELETE /resource/sign_out
def destroy
connected_with_france_connect = current_user.loged_in_with_france_connect
current_user.update_attributes(loged_in_with_france_connect: '')

View file

@ -19,7 +19,7 @@
.input-group
.input-group-addon
%span.glyphicon.glyphicon-asterisk
= f.password_field :password, autocomplete: "off", class: 'form-control'
= f.password_field :password, autocomplete: "off", class: 'form-control', value: @gestionnaire.password
%br
%br
.actions

View file

@ -11,7 +11,7 @@
Quest-ce que FranceConnect ?
%hr
= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
= form_for @user, url: user_session_path, method: :post do |f|
%h4
= f.label :email
.input-group
@ -24,7 +24,7 @@
.input-group
.input-group-addon
%span.fa.fa-asterisk
= f.password_field :password, autocomplete: "off", class: 'form-control'
= f.password_field :password, class: 'form-control', value: "#{@user.password}"
%br
%br
.actions

View file

@ -14,6 +14,15 @@ Rails.application.routes.draw do
passwords: 'users/passwords'
}
devise_scope :user do
get '/users/sign_in/demo' => 'users/sessions#demo'
end
devise_scope :gestionnaire do
get '/gestionnaires/sign_in/demo' => 'gestionnaires/sessions#demo'
end
root 'root#index'
namespace :france_connect do