diff --git a/app/controllers/gestionnaires/sessions_controller.rb b/app/controllers/gestionnaires/sessions_controller.rb index 6e76cc5a1..7fa8e79db 100644 --- a/app/controllers/gestionnaires/sessions_controller.rb +++ b/app/controllers/gestionnaires/sessions_controller.rb @@ -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 diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index 459ee61db..d6c6ad26a 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -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: '') diff --git a/app/views/gestionnaires/sessions/new.html.haml b/app/views/gestionnaires/sessions/new.html.haml index 88a775c77..29a43cadc 100644 --- a/app/views/gestionnaires/sessions/new.html.haml +++ b/app/views/gestionnaires/sessions/new.html.haml @@ -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 diff --git a/app/views/users/sessions/new.html.haml b/app/views/users/sessions/new.html.haml index fb536eefe..370de80a3 100644 --- a/app/views/users/sessions/new.html.haml +++ b/app/views/users/sessions/new.html.haml @@ -11,7 +11,7 @@ Qu’est-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 diff --git a/config/routes.rb b/config/routes.rb index 71296363f..8cac111d6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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