summaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorMichaël Ball <michael.ball@gmail.com>2015-12-05 16:52:33 +0000
committerMichaël Ball <michael.ball@gmail.com>2015-12-05 16:52:33 +0000
commitf0b11a127a127a91217fcd5645c772ce37b2bfcf (patch)
tree76a329d775cc9d0589cf8f84e3211f60cc07b3a9 /models
parent3dc5f811def121a48c17bdb3bb419e5108675e04 (diff)
parent98a61bb09ccacab827d8b0091bdf8ac6f464dacb (diff)
Merge branch 'feature/token-auth' into develop
Diffstat (limited to 'models')
-rw-r--r--models/user.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/models/user.py b/models/user.py
index f912e43..925df5e 100644
--- a/models/user.py
+++ b/models/user.py
@@ -1,4 +1,8 @@
-from common.security import pwd_context
+import os
+
+from flask.ext.login import make_secure_token
+
+from common.security import pwd_context, secret_key
class User:
@@ -46,7 +50,9 @@ class User:
else:
hash = pwd_context.encrypt(password)
- return hash
+ api_key = make_secure_token(hash, os.urandom(64), key=secret_key)
+
+ return hash, api_key
else:
raise ValueError("No user")