From 05e4af5b4c7709ab08194d109ddec8e19f44758d Mon Sep 17 00:00:00 2001 From: Jeroen van Baarsen Date: Thu, 16 Jan 2014 12:14:47 +0100 Subject: Better check on the validity of emails At this moment it was possible to enter emails like: mailto:info@example.com. This was causing some issue in the frontend, since those links became html mailto: links. Fixes: #3516 --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/user.rb b/app/models/user.rb index f2cd554f9c3..a50787cee81 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -103,7 +103,7 @@ class User < ActiveRecord::Base # Validations # validates :name, presence: true - validates :email, presence: true, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/ }, uniqueness: true + validates :email, presence: true, email: {strict_mode: true}, uniqueness: true validates :bio, length: { maximum: 255 }, allow_blank: true validates :extern_uid, allow_blank: true, uniqueness: {scope: :provider} validates :projects_limit, presence: true, numericality: {greater_than_or_equal_to: 0} -- cgit v1.2.1