fixing functional tests
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
class UserMaintenanceMailer < ActionMailer::Base
|
||||
default :from => Danbooru.config.contact_email
|
||||
|
||||
def login_reminder(user)
|
||||
@user = user
|
||||
mail(:to => user.email, :subject => "#{Danbooru.config.app_name} login reminder")
|
||||
end
|
||||
|
||||
def reset_password(user, new_password)
|
||||
@user = user
|
||||
|
||||
30
app/models/user_password_reset_nonce.rb
Normal file
30
app/models/user_password_reset_nonce.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
class UserPasswordResetNonce < ActiveRecord::Base
|
||||
validates_uniqueness_of :email
|
||||
validates_presence_of :email, :key
|
||||
validate :validate_existence_of_email
|
||||
before_validation :initialize_key, :on => :create
|
||||
after_create :deliver_notice
|
||||
|
||||
def deliver_notice
|
||||
Maintenance::User::PasswordResetMailer.request(user).deliver
|
||||
end
|
||||
|
||||
def initialize_key
|
||||
self.key = SecureRandom.hex(16)
|
||||
end
|
||||
|
||||
def validate_existence_of_email
|
||||
if !User.with_email(email).exists?
|
||||
errors[:email] << "is invalid"
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def reset_user!
|
||||
user.reset_password_and_deliver_notice
|
||||
end
|
||||
|
||||
def user
|
||||
@user ||= User.with_email(email).first
|
||||
end
|
||||
end
|
||||
@@ -82,7 +82,7 @@ class WikiPage < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def post_set
|
||||
@post_set ||= PostSets::WikiPage.new(title)
|
||||
@post_set ||= PostSets::Post.new(title)
|
||||
end
|
||||
|
||||
def presenter
|
||||
|
||||
Reference in New Issue
Block a user