lib/blogaze/models/user.rb in blogaze-0.0.3 vs lib/blogaze/models/user.rb in blogaze-0.1.0
- old
+ new
@@ -20,9 +20,16 @@
#
def check_password(password)
BCrypt::Password.new(self.password) == password
end
+ ##
+ # Changes the users password.
+ #
+ def change_password(new_password)
+ self.password = BCrypt::Password.create(new_password)
+ end
+
def validate
super
# Username
validates_unique :username