summaryrefslogtreecommitdiff
path: root/users/app/models/token.rb
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-04-25 10:03:20 -0700
committerjessib <jessib@riseup.net>2013-04-25 10:03:20 -0700
commit15d48c24e529e2f944b026749c5eb35eb4c5cfa7 (patch)
tree071ec86c0fbd85cce8cef0a417423ee8e99c39f0 /users/app/models/token.rb
parent4927abe188c7615fe6844ae0e20144b116a52a99 (diff)
parent53e3198196033f2dd77c09be6919cbef72f3f5d8 (diff)
Merge pull request #40 from azul/feature/token-auth
Token auth with a database of it's own
Diffstat (limited to 'users/app/models/token.rb')
-rw-r--r--users/app/models/token.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/users/app/models/token.rb b/users/app/models/token.rb
new file mode 100644
index 0000000..44a6dfe
--- /dev/null
+++ b/users/app/models/token.rb
@@ -0,0 +1,17 @@
+class Token < CouchRest::Model::Base
+
+ use_database :tokens
+
+ property :user_id, String, accessible: false
+
+ validates :user_id, presence: true
+
+ def initialize(*args)
+ super
+ self.id = SecureRandom.urlsafe_base64(32)
+ end
+
+ design do
+ end
+end
+