summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/anonymous_user.rb4
-rw-r--r--app/models/user.rb10
2 files changed, 14 insertions, 0 deletions
diff --git a/app/models/anonymous_user.rb b/app/models/anonymous_user.rb
index 87239eb..0c1f540 100644
--- a/app/models/anonymous_user.rb
+++ b/app/models/anonymous_user.rb
@@ -28,4 +28,8 @@ class AnonymousUser < Object
def messages
[]
end
+
+ def is_anonymous?
+ true
+ end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 52e20dd..d44df40 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -6,6 +6,8 @@ class User < CouchRest::Model::Base
property :login, String, :accessible => true
property :password_verifier, String, :accessible => true
property :password_salt, String, :accessible => true
+ property :contact_email, String, :accessible => true
+ property :contact_email_key, String, :accessible => true
property :enabled, TrueClass, :default => true
@@ -33,6 +35,10 @@ class User < CouchRest::Model::Base
:confirmation => true,
:format => { :with => /.{8}.*/, :message => "needs to be at least 8 characters long" }
+ validates :contact_email, :allow_blank => true,
+ :email => true,
+ :mx_with_fallback => true
+
timestamps!
design do
@@ -90,6 +96,10 @@ class User < CouchRest::Model::Base
APP_CONFIG['admins'].include? self.login
end
+ def is_anonymous?
+ false
+ end
+
def most_recent_tickets(count=3)
Ticket.for_user(self).limit(count).all #defaults to having most recent updated first
end