diff --git a/app/models/user.rb b/app/models/user.rb index f3f03ab7..ac8ce37c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -64,7 +64,8 @@ class User < ActiveRecord::Base scope :admin, -> { where(is_admin: true) } scope :active, -> { where(is_disabled: false) } - validates :email, presence: true + VALID_EMAIL_REGEX = /\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i + validates :email, presence: true, format: {with: VALID_EMAIL_REGEX } validates :username, uniqueness: {