app/models/adminpanel/user.rb in adminpanel-1.2.12 vs app/models/adminpanel/user.rb in adminpanel-2.0.0

- old
+ new

@@ -1,8 +1,8 @@ module Adminpanel class User < ActiveRecord::Base - attr_accessible :email, :name, :password, :password_confirmation, :group_id + include Adminpanel::Base has_secure_password belongs_to :group #group validation validates_presence_of :group_id @@ -83,15 +83,23 @@ def self.display_name "Usuario" end + def User.new_remember_token + SecureRandom.urlsafe_base64 + end + + def User.digest(token) + Digest::SHA1.hexdigest(token.to_s) + end + def self.icon - 'icon-user' + 'user' end private def create_remember_token - self.remember_token = SecureRandom.base64.tr("+/", "-_") + self.remember_token = User.digest(User.new_remember_token) end end end