new demo link on home page

This commit is contained in:
Xavier J 2017-01-03 10:40:09 +01:00
parent fbeb503d9e
commit cbb5737fdf
5 changed files with 12 additions and 7 deletions

View file

@ -2,8 +2,8 @@ class Administrateurs::SessionsController < Sessions::SessionsController
def demo
return redirect_to root_path if Rails.env.production?
@administrateur = Administrateur.new(email: 'admin@tps.fr', password: 'password')
render 'new'
@user = User.new(email: DemoEmails[:admin], password: 'password')
render 'users/sessions/new'
end
def new

View file

@ -2,8 +2,8 @@ class Gestionnaires::SessionsController < Sessions::SessionsController
def demo
return redirect_to root_path if Rails.env.production?
@gestionnaire = Gestionnaire.new(email: 'gestionnaire@apientreprise.fr', password: 'password')
render 'new'
@user = User.new(email: DemoEmails[:gestionnaire], password: 'password')
render 'users/sessions/new'
end
def new

View file

@ -4,8 +4,7 @@ class Users::SessionsController < Sessions::SessionsController
def demo
return redirect_to root_path if Rails.env.production?
@user = User.new(email: 'demo@tps.fr', password: 'password')
@user = User.new(email: DemoEmails[:user], password: 'password')
render 'new'
end

View file

@ -32,7 +32,8 @@
.actions
= f.submit "Se connecter", class:'btn btn-primary'
%br
= render "users/shared/links"
- if @user.email != DemoEmails[:gestionnaire] && @user.email != DemoEmails[:admin]
= render "users/shared/links"

View file

@ -0,0 +1,5 @@
DemoEmails = {
user: 'demo@tps.fr',
gestionnaire: 'gestionnaire@apientreprise.fr',
admin: 'admin@tps.fr'
}