mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
Creating notifier and first attempt to send instructions to confirm by email. Some minor refactoring.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
require 'devise/authenticable'
|
||||
require 'devise/confirmable'
|
||||
|
||||
require 'devise/notifier'
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ module Devise
|
||||
extend ClassMethods
|
||||
|
||||
before_create :generate_confirmation_token
|
||||
after_create :send_confirmation_instructions
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,8 +36,21 @@ module Devise
|
||||
self.confirmation_token = secure_digest(Time.now.utc, random_string, password)
|
||||
end
|
||||
|
||||
# Send confirmation instructions by email
|
||||
def send_confirmation_instructions
|
||||
# ::Devise::Notifier.deliver_confirmation_instructions(self)
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
|
||||
# Hook default authenticate to provide test whether the account is confirmed
|
||||
# Returns the authenticated_user if it's confirmed, otherwise returns nil
|
||||
# TODO
|
||||
#def authenticate(email, password)
|
||||
# confirmable = super
|
||||
# confirmable if confirmable.confirmed? unless confirmable.nil?
|
||||
#end
|
||||
|
||||
# Find a user by it's confirmation token and try to confirm it.
|
||||
# If no user is found, returns a new user
|
||||
# If the user is already confirmed, create an error for the user
|
||||
|
||||
10
lib/devise/notifier.rb
Normal file
10
lib/devise/notifier.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
module Devise
|
||||
class Notifier < ::ActionMailer::Base
|
||||
self.view_paths.unshift(File.join(File.dirname(__FILE__), '..', '..', 'views'))
|
||||
|
||||
def confirmation_instructions(record)
|
||||
#
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user