Skip to content

Instantly share code, notes, and snippets.

@guilleiguaran
Created October 10, 2010 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guilleiguaran/619336 to your computer and use it in GitHub Desktop.
Save guilleiguaran/619336 to your computer and use it in GitHub Desktop.
class User
include MongoMapper::Document
extend Clearance::User::ClassMethods
include Clearance::User::InstanceMethods
include Clearance::User::Callbacks
include Clearance::User::AttrAccessor
key :confirmation_token, String
key :email, String, :unique => true
key :email_confirmed, Boolean
key :encrypted_password, String
key :password, String
key :remember_token, String
key :salt, String
def email_confirmed?
self.email_confirmed == true
end
def confirm_email!
self.email_confirmed = true
self.confirmation_token = nil
save #save(:validate => false)
end
def reset_remember_token!
generate_remember_token
save #save(:validate => false)
end
def forgot_password!
generate_confirmation_token
save #save(:validate => false)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment