Make supplier signup working as expected
This commit is contained in:
@@ -1,4 +1,16 @@
|
|||||||
class ConfirmationsController < Devise::ConfirmationsController
|
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
|
private
|
||||||
|
|
||||||
def after_confirmation_path_for(resource_name, resource)
|
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 :name, presence: true
|
||||||
validates :iens_profile, numericality: {allow_blank: true}
|
validates :iens_profile, numericality: {allow_blank: true}
|
||||||
|
validates :password, confirmation: true
|
||||||
|
|
||||||
def location=(val)
|
def location=(val)
|
||||||
lat, lng = val.is_a?(Array) ? val : val.strip.split(/[ ,]+/).map(&:to_f)
|
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"
|
||||||
@@ -3,6 +3,8 @@
|
|||||||
en:
|
en:
|
||||||
devise:
|
devise:
|
||||||
confirmations:
|
confirmations:
|
||||||
|
title: "Resend confirmation instructions"
|
||||||
|
submit_text: "Resend confirmation instructions"
|
||||||
confirmed: "Your account was successfully confirmed. Please sign in."
|
confirmed: "Your account was successfully confirmed. Please sign in."
|
||||||
confirmed_and_signed_in: "Your account was successfully confirmed. You are now signed in."
|
confirmed_and_signed_in: "Your account was successfully confirmed. You are now signed in."
|
||||||
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
|
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
|
||||||
@@ -43,6 +45,9 @@ en:
|
|||||||
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
||||||
updated: "Your password was changed successfully. You are now signed in."
|
updated: "Your password was changed successfully. You are now signed in."
|
||||||
updated_not_active: "Your password was changed successfully."
|
updated_not_active: "Your password was changed successfully."
|
||||||
|
edit:
|
||||||
|
title: Change your password
|
||||||
|
button: Change password
|
||||||
registrations:
|
registrations:
|
||||||
destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
|
destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
|
||||||
signed_up: "Welcome! You have signed up successfully."
|
signed_up: "Welcome! You have signed up successfully."
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ nl:
|
|||||||
|
|
||||||
devise:
|
devise:
|
||||||
confirmations:
|
confirmations:
|
||||||
|
title: "Struur opnieuw bevestigingsinstructies"
|
||||||
|
submit_text: "Stuur opnieuw bevestigingsinstructies"
|
||||||
send_instructions: 'Er wordt een een e-mail naar je toe gestuurd waarin je je account kan bevestigen.'
|
send_instructions: 'Er wordt een een e-mail naar je toe gestuurd waarin je je account kan bevestigen.'
|
||||||
confirmed: 'De activatie van je account is succesvol. Je bent nu aangemeld!'
|
confirmed: 'De activatie van je account is succesvol. Je bent nu aangemeld!'
|
||||||
did_not_receive_instructions_link: "Heeft u geen bevestigingsinstructies ontvangen?"
|
did_not_receive_instructions_link: "Heeft u geen bevestigingsinstructies ontvangen?"
|
||||||
@@ -42,6 +44,9 @@ nl:
|
|||||||
updated: 'Uw wachtwoord is succesvol gewijzigd. U bent nu ingelogd.'
|
updated: 'Uw wachtwoord is succesvol gewijzigd. U bent nu ingelogd.'
|
||||||
forgot_password: Wachtwoord vergeten?
|
forgot_password: Wachtwoord vergeten?
|
||||||
send_instructions_button: Stuur mij reset instructies
|
send_instructions_button: Stuur mij reset instructies
|
||||||
|
edit:
|
||||||
|
title: Verander je wachtwoord
|
||||||
|
button: Verander wachtwoord
|
||||||
registrations:
|
registrations:
|
||||||
title: Aanmelden
|
title: Aanmelden
|
||||||
button: Aanmelden
|
button: Aanmelden
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
Qwaiter::Application.routes.draw do
|
Qwaiter::Application.routes.draw do
|
||||||
devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
|
devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
|
||||||
devise_for :suppliers, controllers: { confirmations: 'confirmations' }
|
devise_for :suppliers, controllers: { confirmations: 'confirmations', registrations: 'registrations' }
|
||||||
devise_for :administrators
|
devise_for :administrators
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
resources :users do
|
resources :users do
|
||||||
|
|||||||
Reference in New Issue
Block a user