diff options
author | jessib <jessib@riseup.net> | 2013-08-27 11:22:52 -0700 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2013-08-27 11:22:52 -0700 |
commit | e481b8cbc05a858674a59ef36d695973622f6b3a (patch) | |
tree | 8a20143ce831d71076a8c3913664b3a67742ed6b /users/app/models/token.rb | |
parent | 441db4736e0cd003caf9c8f7b3fbdb1ffa72b969 (diff) | |
parent | fdf9c5f9ea605020ea371de8e221efe8e5d5ba32 (diff) |
Merge pull request #72 from azul/feature/token-based-auth
Feature: Token based auth
Diffstat (limited to 'users/app/models/token.rb')
-rw-r--r-- | users/app/models/token.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/users/app/models/token.rb b/users/app/models/token.rb index cc62778..514b97f 100644 --- a/users/app/models/token.rb +++ b/users/app/models/token.rb @@ -6,6 +6,10 @@ class Token < CouchRest::Model::Base validates :user_id, presence: true + def user + User.find(self.user_id) + end + def initialize(*args) super self.id = SecureRandom.urlsafe_base64(32).gsub(/^_*/, '') |