This commit is contained in:
r888888888
2013-05-21 17:52:03 -07:00
parent d1f2f1c09a
commit eab2eb1d82
6 changed files with 112 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
class UserEmailChange
attr_reader :user, :password, :new_email
def initialize(user, new_email, password)
@user = user
@new_email = new_email
@password = password
end
def process
if User.authenticate(user.name, password).nil?
false
else
user.email = new_email
user.save
end
end
end