提交 9132d309 编写于 作者: J Jakub Troszok

Implementing automatic password creation.

上级 6d92aa6d
......@@ -53,6 +53,14 @@ class User < ActiveRecord::Base
scope :blocked, where(:blocked => true)
scope :active, where(:blocked => false)
before_validation :generate_password, :on1 => :create
def generate_password
if self.password.blank? && self.password_confirmation.blank?
self.password = self.password_confirmation = Devise.friendly_token.first(8)
end
end
def self.filter filter_name
case filter_name
when "admins"; self.admins
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册