pundit: convert emails to pundit.
This commit is contained in:
@@ -12,4 +12,18 @@ class EmailAddress < ApplicationRecord
|
||||
self.normalized_address = EmailNormalizer.normalize(value) || address
|
||||
super
|
||||
end
|
||||
|
||||
concerning :VerificationMethods do
|
||||
def verifier
|
||||
@verifier ||= Danbooru::MessageVerifier.new(:email_verification_key)
|
||||
end
|
||||
|
||||
def verification_key
|
||||
verifier.generate(id)
|
||||
end
|
||||
|
||||
def valid_key?(key)
|
||||
id == verifier.verified(key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user