[#884] add user
This commit is contained in:
parent
f7fb0f99bf
commit
78e86f00ea
33 changed files with 624 additions and 61 deletions
|
@ -16,6 +16,7 @@
|
|||
*= require_self
|
||||
*= require bootstrap-datepicker3
|
||||
*= require leaflet
|
||||
*= require font-awesome
|
||||
*/
|
||||
@import "bootstrap-sprockets";
|
||||
@import "bootstrap";
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class StartController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
def index
|
||||
get_procedure_infos
|
||||
|
||||
|
|
28
app/controllers/users/confirmations_controller.rb
Normal file
28
app/controllers/users/confirmations_controller.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
class Users::ConfirmationsController < Devise::ConfirmationsController
|
||||
# GET /resource/confirmation/new
|
||||
# def new
|
||||
# super
|
||||
# end
|
||||
|
||||
# POST /resource/confirmation
|
||||
# def create
|
||||
# super
|
||||
# end
|
||||
|
||||
# GET /resource/confirmation?confirmation_token=abcdef
|
||||
# def show
|
||||
# super
|
||||
# end
|
||||
|
||||
# protected
|
||||
|
||||
# The path used after resending confirmation instructions.
|
||||
# def after_resending_confirmation_instructions_path_for(resource_name)
|
||||
# super(resource_name)
|
||||
# end
|
||||
|
||||
# The path used after confirmation.
|
||||
# def after_confirmation_path_for(resource_name, resource)
|
||||
# super(resource_name, resource)
|
||||
# end
|
||||
end
|
28
app/controllers/users/omniauth_callbacks_controller.rb
Normal file
28
app/controllers/users/omniauth_callbacks_controller.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
# You should configure your model like this:
|
||||
# devise :omniauthable, omniauth_providers: [:twitter]
|
||||
|
||||
# You should also create an action method in this controller like this:
|
||||
# def twitter
|
||||
# end
|
||||
|
||||
# More info at:
|
||||
# https://github.com/plataformatec/devise#omniauth
|
||||
|
||||
# GET|POST /resource/auth/twitter
|
||||
# def passthru
|
||||
# super
|
||||
# end
|
||||
|
||||
# GET|POST /users/auth/twitter/callback
|
||||
# def failure
|
||||
# super
|
||||
# end
|
||||
|
||||
# protected
|
||||
|
||||
# The path used when omniauth fails
|
||||
# def after_omniauth_failure_path_for(scope)
|
||||
# super(scope)
|
||||
# end
|
||||
end
|
32
app/controllers/users/passwords_controller.rb
Normal file
32
app/controllers/users/passwords_controller.rb
Normal file
|
@ -0,0 +1,32 @@
|
|||
class Users::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
|
60
app/controllers/users/registrations_controller.rb
Normal file
60
app/controllers/users/registrations_controller.rb
Normal file
|
@ -0,0 +1,60 @@
|
|||
class Users::RegistrationsController < Devise::RegistrationsController
|
||||
# before_filter :configure_sign_up_params, only: [:create]
|
||||
# before_filter :configure_account_update_params, only: [:update]
|
||||
|
||||
# GET /resource/sign_up
|
||||
# def new
|
||||
# super
|
||||
# end
|
||||
|
||||
# POST /resource
|
||||
# def create
|
||||
# super
|
||||
# end
|
||||
|
||||
# GET /resource/edit
|
||||
# def edit
|
||||
# super
|
||||
# end
|
||||
|
||||
# PUT /resource
|
||||
# def update
|
||||
# super
|
||||
# end
|
||||
|
||||
# DELETE /resource
|
||||
# def destroy
|
||||
# super
|
||||
# end
|
||||
|
||||
# GET /resource/cancel
|
||||
# Forces the session data which is usually expired after sign
|
||||
# in to be expired now. This is useful if the user wants to
|
||||
# cancel oauth signing in/up in the middle of the process,
|
||||
# removing all OAuth session data.
|
||||
# def cancel
|
||||
# super
|
||||
# end
|
||||
|
||||
# protected
|
||||
|
||||
# You can put the params you want to permit in the empty array.
|
||||
# def configure_sign_up_params
|
||||
# devise_parameter_sanitizer.for(:sign_up) << :attribute
|
||||
# end
|
||||
|
||||
# You can put the params you want to permit in the empty array.
|
||||
# def configure_account_update_params
|
||||
# devise_parameter_sanitizer.for(:account_update) << :attribute
|
||||
# end
|
||||
|
||||
# The path used after sign up.
|
||||
# def after_sign_up_path_for(resource)
|
||||
# super(resource)
|
||||
# end
|
||||
|
||||
# The path used after sign up for inactive accounts.
|
||||
# def after_inactive_sign_up_path_for(resource)
|
||||
# super(resource)
|
||||
# end
|
||||
end
|
25
app/controllers/users/sessions_controller.rb
Normal file
25
app/controllers/users/sessions_controller.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
class Users::SessionsController < Devise::SessionsController
|
||||
# before_filter :configure_sign_in_params, only: [:create]
|
||||
|
||||
# GET /resource/sign_in
|
||||
# def new
|
||||
# super
|
||||
# end
|
||||
|
||||
# POST /resource/sign_in
|
||||
# def create
|
||||
# super
|
||||
# end
|
||||
|
||||
# DELETE /resource/sign_out
|
||||
# def destroy
|
||||
# super
|
||||
# end
|
||||
|
||||
# protected
|
||||
|
||||
# You can put the params you want to permit in the empty array.
|
||||
# def configure_sign_in_params
|
||||
# devise_parameter_sanitizer.for(:sign_in) << :attribute
|
||||
# end
|
||||
end
|
28
app/controllers/users/unlocks_controller.rb
Normal file
28
app/controllers/users/unlocks_controller.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
class Users::UnlocksController < Devise::UnlocksController
|
||||
# GET /resource/unlock/new
|
||||
# def new
|
||||
# super
|
||||
# end
|
||||
|
||||
# POST /resource/unlock
|
||||
# def create
|
||||
# super
|
||||
# end
|
||||
|
||||
# GET /resource/unlock?unlock_token=abcdef
|
||||
# def show
|
||||
# super
|
||||
# end
|
||||
|
||||
# protected
|
||||
|
||||
# The path used after sending unlock password instructions
|
||||
# def after_sending_unlock_instructions_path_for(resource)
|
||||
# super(resource)
|
||||
# end
|
||||
|
||||
# The path used after unlocking the resource
|
||||
# def after_unlock_path_for(resource)
|
||||
# super(resource)
|
||||
# end
|
||||
end
|
6
app/controllers/welcome_controller.rb
Normal file
6
app/controllers/welcome_controller.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class WelcomeController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
def index
|
||||
|
||||
end
|
||||
end
|
6
app/models/user.rb
Normal file
6
app/models/user.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class User < ActiveRecord::Base
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||
devise :database_authenticatable, :registerable,
|
||||
:recoverable, :rememberable, :trackable, :validatable
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
.container
|
||||
.container#recap_info_entreprise
|
||||
%h2 Récapitulatif de vos informations <em id="insee_infogreffe" class='small'>(récupérées auprès de l'INSEE et d'INFOGREFFE)</em>
|
||||
%br
|
||||
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
%div{style: 'decorate:none; box-shadow:none; float:right; margin-top:8px'}
|
||||
= current_gestionnaire.email
|
||||
= link_to "Déconnexion", '/gestionnaires/sign_out', method: :delete, :class => 'btn btn-md'
|
||||
- elsif user_signed_in?
|
||||
%div.user{style: 'decorate:none; box-shadow:none; float:right; margin-top:8px'}
|
||||
%i.fa.fa-user
|
||||
= current_user.email
|
||||
= link_to "Déconnexion", '/users/sign_out', method: :delete, :class => 'btn btn-md'
|
||||
|
||||
#flash_message.center
|
||||
- if flash.notice
|
||||
|
|
16
app/views/users/confirmations/new.html.erb
Normal file
16
app/views/users/confirmations/new.html.erb
Normal file
|
@ -0,0 +1,16 @@
|
|||
<h2>Resend confirmation instructions</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Resend confirmation instructions" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "users/shared/links" %>
|
|
@ -0,0 +1,5 @@
|
|||
<p>Welcome <%= @email %>!</p>
|
||||
|
||||
<p>You can confirm your account email through the link below:</p>
|
||||
|
||||
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
|
|
@ -0,0 +1,8 @@
|
|||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
||||
|
||||
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
|
||||
|
||||
<p>If you didn't request this, please ignore this email.</p>
|
||||
<p>Your password won't change until you access the link above and create a new one.</p>
|
7
app/views/users/mailer/unlock_instructions.html.erb
Normal file
7
app/views/users/mailer/unlock_instructions.html.erb
Normal file
|
@ -0,0 +1,7 @@
|
|||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
|
||||
|
||||
<p>Click the link below to unlock your account:</p>
|
||||
|
||||
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
|
22
app/views/users/passwords/edit.html.erb
Normal file
22
app/views/users/passwords/edit.html.erb
Normal file
|
@ -0,0 +1,22 @@
|
|||
<h2>Change your password</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= f.hidden_field :reset_password_token %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password, "New password" %><br />
|
||||
<%= f.password_field :password, autofocus: true, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Change my password" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "users/shared/links" %>
|
16
app/views/users/passwords/new.html.erb
Normal file
16
app/views/users/passwords/new.html.erb
Normal file
|
@ -0,0 +1,16 @@
|
|||
<h2>Forgot your password?</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Send me reset password instructions" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "users/shared/links" %>
|
39
app/views/users/registrations/edit.html.erb
Normal file
39
app/views/users/registrations/edit.html.erb
Normal file
|
@ -0,0 +1,39 @@
|
|||
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
||||
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><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="field">
|
||||
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
||||
<%= f.password_field :current_password, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Update" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<h3>Cancel my account</h3>
|
||||
|
||||
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
|
||||
|
||||
<%= link_to "Back", :back %>
|
29
app/views/users/registrations/new.html.erb
Normal file
29
app/views/users/registrations/new.html.erb
Normal file
|
@ -0,0 +1,29 @@
|
|||
<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 %>
|
||||
|
||||
<%= render "users/shared/links" %>
|
19
app/views/users/sessions/new.html.haml
Normal file
19
app/views/users/sessions/new.html.haml
Normal file
|
@ -0,0 +1,19 @@
|
|||
%h2#login_user Connexion
|
||||
= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
|
||||
.field
|
||||
= f.label :email
|
||||
%br
|
||||
= f.email_field :email, autofocus: true
|
||||
.field
|
||||
= f.label :password
|
||||
%br
|
||||
= f.password_field :password, autocomplete: "off"
|
||||
%br
|
||||
/ - if devise_mapping.rememberable?
|
||||
/ .field
|
||||
/ = f.check_box :remember_me
|
||||
/ = f.label :remember_me
|
||||
.actions
|
||||
= f.submit "Se connecter"
|
||||
|
||||
= render "users/shared/links"
|
25
app/views/users/shared/_links.html.erb
Normal file
25
app/views/users/shared/_links.html.erb
Normal file
|
@ -0,0 +1,25 @@
|
|||
<%- if controller_name != 'sessions' %>
|
||||
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
||||
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
||||
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
||||
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.omniauthable? %>
|
||||
<%- resource_class.omniauth_providers.each do |provider| %>
|
||||
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
|
||||
<% end -%>
|
||||
<% end -%>
|
16
app/views/users/unlocks/new.html.erb
Normal file
16
app/views/users/unlocks/new.html.erb
Normal file
|
@ -0,0 +1,16 @@
|
|||
<h2>Resend unlock instructions</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :email %><br />
|
||||
<%= f.email_field :email, autofocus: true %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Resend unlock instructions" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "users/shared/links" %>
|
2
app/views/welcome/index.html.haml
Normal file
2
app/views/welcome/index.html.haml
Normal file
|
@ -0,0 +1,2 @@
|
|||
%h1 coucou
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue