diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb
index ad7a1506..6da17d95 100644
--- a/app/controllers/confirmations_controller.rb
+++ b/app/controllers/confirmations_controller.rb
@@ -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)
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
new file mode 100644
index 00000000..cac13d6b
--- /dev/null
+++ b/app/controllers/registrations_controller.rb
@@ -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
diff --git a/app/models/supplier.rb b/app/models/supplier.rb
index 2ec7f87f..307443f6 100644
--- a/app/models/supplier.rb
+++ b/app/models/supplier.rb
@@ -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)
diff --git a/app/views/suppliers/confirmations/new.html.erb b/app/views/suppliers/confirmations/new.html.erb
deleted file mode 100644
index a995f57a..00000000
--- a/app/views/suppliers/confirmations/new.html.erb
+++ /dev/null
@@ -1,12 +0,0 @@
-
Struur opnieuw bevestigingsinstructies
-
-<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
- <%= devise_error_messages! %>
-
- <%= f.label :email %>
- <%= f.email_field :email %>
-
- <%= f.submit "Stuur opnieuw bevestigingsinstructies" %>
-<% end %>
-
-<%= render "links" %>
diff --git a/app/views/suppliers/confirmations/new.html.slim b/app/views/suppliers/confirmations/new.html.slim
new file mode 100644
index 00000000..1dab33e4
--- /dev/null
+++ b/app/views/suppliers/confirmations/new.html.slim
@@ -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"
diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml
index ee0dd2e2..6b554133 100644
--- a/config/locales/devise.en.yml
+++ b/config/locales/devise.en.yml
@@ -3,6 +3,8 @@
en:
devise:
confirmations:
+ title: "Resend confirmation instructions"
+ submit_text: "Resend confirmation instructions"
confirmed: "Your account was successfully confirmed. Please sign 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."
@@ -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."
updated: "Your password was changed successfully. You are now signed in."
updated_not_active: "Your password was changed successfully."
+ edit:
+ title: Change your password
+ button: Change password
registrations:
destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
signed_up: "Welcome! You have signed up successfully."
diff --git a/config/locales/devise.nl.yml b/config/locales/devise.nl.yml
index a30c49b5..d8734d1c 100644
--- a/config/locales/devise.nl.yml
+++ b/config/locales/devise.nl.yml
@@ -10,6 +10,8 @@ nl:
devise:
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.'
confirmed: 'De activatie van je account is succesvol. Je bent nu aangemeld!'
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.'
forgot_password: Wachtwoord vergeten?
send_instructions_button: Stuur mij reset instructies
+ edit:
+ title: Verander je wachtwoord
+ button: Verander wachtwoord
registrations:
title: Aanmelden
button: Aanmelden
diff --git a/config/routes.rb b/config/routes.rb
index 1dfdcdb7..6133dec8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,6 @@
Qwaiter::Application.routes.draw do
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
namespace :admin do
resources :users do