Make supplier signup working as expected
This commit is contained in:
@@ -1,4 +1,16 @@
|
||||
class ConfirmationsController < Devise::ConfirmationsController
|
||||
|
||||
# GET /resource/confirmation?confirmation_token=abcdef
|
||||
# hack described by:
|
||||
# https://github.com/plataformatec/devise/pull/2728
|
||||
# restore sign_in after confirmation behaviour. More unsafe, but
|
||||
# customer satisfaction is dominant here
|
||||
def show
|
||||
super do |resource|
|
||||
sign_in(resource_name, resource) if resource && resource.errors.empty?
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def after_confirmation_path_for(resource_name, resource)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class RegistrationsController < Devise::RegistrationsController
|
||||
|
||||
private
|
||||
|
||||
# override devise internal to allow name as sign_up param
|
||||
def sign_up_params
|
||||
params.require(resource_name).permit resource_class.authentication_keys + [:name, :password, :password_confirmation]
|
||||
end
|
||||
end
|
||||
@@ -36,6 +36,7 @@ class Supplier
|
||||
|
||||
validates :name, presence: true
|
||||
validates :iens_profile, numericality: {allow_blank: true}
|
||||
validates :password, confirmation: true
|
||||
|
||||
def location=(val)
|
||||
lat, lng = val.is_a?(Array) ? val : val.strip.split(/[ ,]+/).map(&:to_f)
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<h2>Struur opnieuw bevestigingsinstructies</h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<div><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></div>
|
||||
|
||||
<div><%= f.submit "Stuur opnieuw bevestigingsinstructies" %></div>
|
||||
<% end %>
|
||||
|
||||
<%= render "links" %>
|
||||
@@ -0,0 +1,12 @@
|
||||
h2= t('devise.confirmations.title')
|
||||
|
||||
= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), html: { method: :post, class: 'form-horizontal' }) do |f|
|
||||
= devise_error_messages!
|
||||
.control-group
|
||||
= f.label :email, class: 'control-label'
|
||||
.controls
|
||||
= f.email_field :email
|
||||
|
||||
.control-group
|
||||
.controls= f.submit t('devise.confirmations.submit_text'), class: 'btn-primary'
|
||||
= render "links"
|
||||
Reference in New Issue
Block a user