Add a field for user email address

This commit is contained in:
Jyri-Petteri Paloposki 2020-07-20 18:41:10 +03:00
parent 0ff46f63dc
commit dbaa9a85cb
7 changed files with 18 additions and 3 deletions

View file

@ -107,6 +107,7 @@ class User < ApplicationRecord
validates_length_of :login, within: 3..80
validates_uniqueness_of :login, on: :create
validate :validate_auth_type
validates :email, format: { with: URI::MailTo::EMAIL_REGEXP }
before_create :crypt_password, :generate_token
before_update :crypt_password