From aa84a06bf96eb1fd5073263ee5955a62c61b9dc8 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 20 Dec 2012 12:47:31 +0100 Subject: validating email domain and displaying it as the placeholder This even works client side. :) --- users/app/models/user.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'users/app/models/user.rb') diff --git a/users/app/models/user.rb b/users/app/models/user.rb index 1999a28..8f776a3 100644 --- a/users/app/models/user.rb +++ b/users/app/models/user.rb @@ -32,6 +32,10 @@ class User < CouchRest::Model::Base validates :email, :format => { :with => /\A(([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,}))?\Z/, :message => "needs to be a valid email address"} + validates :email, + :format => { :with => /@#{APP_CONFIG[:domain]}\Z/, + :message => "needs to end in @#{APP_CONFIG[:domain]}"} + validates :email_forward, :format => { :with => /\A(([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,}))?\Z/, :message => "needs to be a valid email address"} -- cgit v1.2.3