aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/user.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index b2f7c8ec9..53853530f 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -6,4 +6,10 @@ class User < ActiveRecord::Base
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
+
+ belongs_to :organisation
+
+ before_validation(:on => :create) do
+ self.password ||= Devise.friendly_token.first(6)
+ end
end