mirror of
https://github.com/danbee/danbarberphoto
synced 2025-03-04 08:49:07 +00:00
Refactor.
This commit is contained in:
parent
4ece7c782b
commit
3a7772c85b
@ -6,10 +6,7 @@ class AdminUser < ActiveRecord::Base
|
|||||||
|
|
||||||
# new function to set the password without knowing the current password used in our confirmation controller.
|
# new function to set the password without knowing the current password used in our confirmation controller.
|
||||||
def attempt_set_password(params)
|
def attempt_set_password(params)
|
||||||
p = {}
|
update_attributes(params.slice(:password, :password_confirmation))
|
||||||
p[:password] = params[:password]
|
|
||||||
p[:password_confirmation] = params[:password_confirmation]
|
|
||||||
update_attributes(p)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# new function to return whether a password has been set
|
# new function to return whether a password has been set
|
||||||
@ -19,7 +16,7 @@ class AdminUser < ActiveRecord::Base
|
|||||||
|
|
||||||
# new function to provide access to protected method unless_confirmed
|
# new function to provide access to protected method unless_confirmed
|
||||||
def only_if_unconfirmed
|
def only_if_unconfirmed
|
||||||
unless_confirmed {yield}
|
unless_confirmed { yield }
|
||||||
end
|
end
|
||||||
|
|
||||||
def password_required?
|
def password_required?
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user