Sha256: 06ba4eb3193f1c99f6460c78f094d582fb5d2099276fcd6e9aad71b9e2aef49b
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
class UserResetPasswordForm include Model::NonPersistent include Aerogel::Db::SecurePassword field :email, type: String field :password_reset_token, type: String use_secure_password validates_presence_of :email, :password_reset_token validates_format_of :email, with: /@/, message: :invalid_format # validates uniqueness of provider & uid (email) among all users validate do |record| user = User.where( 'emails.email' => record.email ).first unless user record.errors.add :email, :not_registered return end authentication = user.authentications.where( provider: :password, uid: record.email ).first unless authentication record.errors.add :email, :password_login_not_allowed return end end # Returns User object, corresponding to this email address # def user User.where( 'emails.email' => email ).first end # Returns UserEmail object, corresponding to this email address # def authentication user.authentications.where( provider: :password, uid: email ).first end end # class UserRequestPasswordResetForm
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aerogel-users-1.4.3 | db/model/user_reset_password_form.rb |