1
0
Fork 0

Enable Devise email unlock

This commit is contained in:
Alex Kotov 2018-12-04 01:26:33 +05:00
parent 9e5582f4d5
commit 38558a284f
No known key found for this signature in database
GPG key ID: 4E831250F47DE154
4 changed files with 56 additions and 1 deletions

View file

@ -0,0 +1,33 @@
# frozen_string_literal: true
class Users::UnlocksController < Devise::UnlocksController
skip_after_action :verify_authorized
skip_after_action :verify_policy_scoped
# 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

View file

@ -0,0 +1,21 @@
<div class="container">
<h2><%= translate '.resend_unlock_instructions' %></h2>
<%= simple_form_for resource, as: resource_name, url: unlock_path(resource_name) do |f| %>
<%= f.error_notification %>
<%= f.full_error :unlock_token %>
<div class="form-inputs">
<%= f.input :email,
required: true,
autofocus: true,
input_html: { autocomplete: 'email' } %>
</div>
<div class="form-actions">
<%= f.button :submit, translate('.resend_unlock_instructions') %>
</div>
<% end %>
<%= render 'users/shared/links' %>
</div>

View file

@ -193,7 +193,7 @@ Devise.setup do |config|
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
config.unlock_strategy = :time
config.unlock_strategy = :both
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.

View file

@ -26,6 +26,7 @@ Rails.application.routes.draw do
registrations: 'users/registrations',
confirmations: 'users/confirmations',
passwords: 'users/passwords',
unlocks: 'users/unlocks',
}
resources :membership_applications, only: %i[new create]