Sha256: 9928c2be5aa470434425d48f9cce92f1ef51bd78ce7f32e868c6c9473a0f5ddc
Contents?: true
Size: 899 Bytes
Versions: 33
Compression:
Stored size: 899 Bytes
Contents
module Workarea class User class PasswordReset include ApplicationDocument include UrlToken belongs_to :user, class_name: 'Workarea::User', index: true index( { created_at: 1 }, { expire_after_seconds: Workarea.config.password_reset_timeout } ) def self.setup!(email) user = User.find_by_email(email) return nil unless user where(user_id: user.id).destroy_all create!(user: user) end def complete(new_password) if new_password.blank? errors.add(:password, I18n.t('errors.messages.blank')) return false end if user.update_attributes(password: new_password) destroy else user.errors.each do |attribute, error| errors.add(attribute, error) end false end end end end end
Version data entries
33 entries across 33 versions & 1 rubygems