summaryrefslogtreecommitdiff
path: root/users/app/models/local_email.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-07-18 17:17:36 +0200
committerAzul <azul@leap.se>2013-07-24 10:55:51 +0200
commit0acace58c31c96fc1f8836167aeb4f204f72617f (patch)
tree4738cf2fab5f67afdcdae7373914b9bd66cfd95e /users/app/models/local_email.rb
parentd96fac2de074bbe3a44d888af5ceaff45b1b9b27 (diff)
allow available and unique forwards only
Diffstat (limited to 'users/app/models/local_email.rb')
-rw-r--r--users/app/models/local_email.rb30
1 files changed, 0 insertions, 30 deletions
diff --git a/users/app/models/local_email.rb b/users/app/models/local_email.rb
index e71d494..c1f7c11 100644
--- a/users/app/models/local_email.rb
+++ b/users/app/models/local_email.rb
@@ -1,10 +1,5 @@
class LocalEmail < Email
-=begin
- validate :unique_on_server
- validate :unique_alias_for_user
- validate :differs_from_login
-=end
def self.domain
APP_CONFIG[:domain]
@@ -16,8 +11,6 @@ class LocalEmail < Email
:message => "needs to end in @#{domain}"
}
-
-
def initialize(s)
super
append_domain_if_needed
@@ -37,29 +30,6 @@ class LocalEmail < Email
protected
- def unique_on_server
- has_email = User.find_by_login_or_alias(username)
- if has_email && has_email != self.casted_by
- errors.add :username, "has already been taken"
- end
- end
-
- def unique_alias_for_user
- aliases = self.casted_by.email_aliases
- if aliases.select{|a|a.username == self.username}.count > 1
- errors.add :username, "is already your alias"
- end
- end
-
- def differs_from_login
- # If this has not changed but the email let's mark the email invalid instead.
- return if self.persisted?
- user = self.casted_by
- if user.login == self.username
- errors.add :username, "may not be the same as your email address"
- end
- end
-
def append_domain_if_needed
unless self.index('@')
self << '@' + domain