16 changed files with 91 additions and 34 deletions
			
			
		@ -0,0 +1,7 @@
					 | 
				
			||||
class User::ConfirmationsController < Devise::ConfirmationsController | 
				
			||||
protected | 
				
			||||
 | 
				
			||||
  def after_confirmation_path_for(_resource_name, resource) | 
				
			||||
    new_user_confirmation_path(resource) | 
				
			||||
  end | 
				
			||||
end | 
				
			||||
@ -1,4 +1,4 @@
					 | 
				
			||||
class Auth::SessionsController < Devise::SessionsController | 
				
			||||
class User::SessionsController < Devise::SessionsController | 
				
			||||
  include Helpers::Email | 
				
			||||
 | 
				
			||||
  def create | 
				
			||||
@ -1,16 +1,32 @@
					 | 
				
			||||
<h2>Resend confirmation instructions</h2> | 
				
			||||
<% content_for :title, "Set your password" %> | 
				
			||||
 | 
				
			||||
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> | 
				
			||||
  <%= render "devise/shared/error_messages", resource: resource %> | 
				
			||||
<% content_for :before_content do %> | 
				
			||||
  <%= govuk_back_link( | 
				
			||||
    text: 'Back', | 
				
			||||
    href: :back, | 
				
			||||
  ) %> | 
				
			||||
<% end %> | 
				
			||||
 | 
				
			||||
<%= form_for(@user, as: :user, html: { method: :patch }) do |f| %> | 
				
			||||
  <div class="govuk-grid-row"> | 
				
			||||
    <div class="govuk-grid-column-two-thirds"> | 
				
			||||
      <%= f.govuk_error_summary(presenter: ErrorSummaryFullMessagesPresenter) %> | 
				
			||||
 | 
				
			||||
      <h1 class="govuk-heading-l"> | 
				
			||||
        <%= content_for(:title) %> | 
				
			||||
      </h1> | 
				
			||||
 | 
				
			||||
  <%= f.govuk_email_field :email, | 
				
			||||
    label: { text: "Email address" }, | 
				
			||||
    autocomplete: "email", | 
				
			||||
    spellcheck: "false", | 
				
			||||
    value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) | 
				
			||||
      <%= f.govuk_password_field :password, | 
				
			||||
        label: { text: "New password" }, | 
				
			||||
        hint: @minimum_password_length ? { text: "Your password must be at least #{@minimum_password_length} characters and hard to guess." } : nil, | 
				
			||||
        autocomplete: "new-password" | 
				
			||||
      %> | 
				
			||||
 | 
				
			||||
  <%= f.govuk_submit "Resend confirmation instructions" %> | 
				
			||||
<% end %> | 
				
			||||
      <%= f.govuk_password_field :password_confirmation, | 
				
			||||
        label: { text: "Confirm new password" } | 
				
			||||
      %> | 
				
			||||
 | 
				
			||||
<%= render "devise/shared/links" %> | 
				
			||||
      <%= f.govuk_submit "Update" %> | 
				
			||||
    </div> | 
				
			||||
  </div> | 
				
			||||
<% end %> | 
				
			||||
					 | 
				
			||||
@ -0,0 +1,11 @@
					 | 
				
			||||
class UsersConfirmable < ActiveRecord::Migration[7.0] | 
				
			||||
  def change | 
				
			||||
    change_table :users, bulk: true do |t| | 
				
			||||
      ## Confirmable | 
				
			||||
      t.string   :confirmation_token | 
				
			||||
      t.datetime :confirmed_at | 
				
			||||
      t.datetime :confirmation_sent_at | 
				
			||||
      t.string   :unconfirmed_email # Only if using reconfirmable | 
				
			||||
    end | 
				
			||||
  end | 
				
			||||
end | 
				
			||||
					Loading…
					
					
				
		Reference in new issue