Send different Devise mail for re-confirmations
This commit is contained in:
		
							parent
							
								
									75bd879f84
								
							
						
					
					
						commit
						b1a693e7cf
					
				
							
								
								
									
										34
									
								
								app/mailers/devise/mailer.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								app/mailers/devise/mailer.rb
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,34 @@
 | 
			
		||||
# frozen_string_literal: true
 | 
			
		||||
 | 
			
		||||
if defined?(ActionMailer)
 | 
			
		||||
  class Devise::Mailer < Devise.parent_mailer.constantize
 | 
			
		||||
    include Devise::Mailers::Helpers
 | 
			
		||||
 | 
			
		||||
    def confirmation_instructions(record, token, opts = {})
 | 
			
		||||
      @token = token
 | 
			
		||||
      if record.pending_reconfirmation?
 | 
			
		||||
        devise_mail(record, :reconfirmation_instructions, opts)
 | 
			
		||||
      else
 | 
			
		||||
        devise_mail(record, :confirmation_instructions, opts)
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def reset_password_instructions(record, token, opts = {})
 | 
			
		||||
      @token = token
 | 
			
		||||
      devise_mail(record, :reset_password_instructions, opts)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def unlock_instructions(record, token, opts = {})
 | 
			
		||||
      @token = token
 | 
			
		||||
      devise_mail(record, :unlock_instructions, opts)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def email_changed(record, opts = {})
 | 
			
		||||
      devise_mail(record, :email_changed, opts)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def password_change(record, opts = {})
 | 
			
		||||
      devise_mail(record, :password_change, opts)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
@ -0,0 +1,5 @@
 | 
			
		||||
<p>Hello <%= @resource.cn %>,</p>
 | 
			
		||||
 | 
			
		||||
<p>Please confirm your new email address through the link below:</p>
 | 
			
		||||
 | 
			
		||||
<p><%= link_to 'Confirm my address', confirmation_url(@resource, confirmation_token: @token) %></p>
 | 
			
		||||
@ -3,7 +3,7 @@
 | 
			
		||||
en:
 | 
			
		||||
  devise:
 | 
			
		||||
    confirmations:
 | 
			
		||||
      confirmed: "Thanks for confirming your email address! Your account has been activated."
 | 
			
		||||
      confirmed: "Thanks for confirming your email address."
 | 
			
		||||
      send_instructions: "You will receive an email with instructions for how to confirm your email address in a moment."
 | 
			
		||||
      send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
 | 
			
		||||
    failure:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user