Conditions | 2 |
Total Lines | 10 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | from flask import current_app, g |
||
9 | @auth.verify_password |
||
10 | def verify_password(username_or_token, password): |
||
11 | if current_app.config['USE_TOKEN_AUTH']: |
||
12 | # token authentication |
||
13 | g.user = User.verify_auth_token(username_or_token) |
||
14 | return g.user is not None |
||
15 | else: |
||
16 | # username/password authentication |
||
17 | g.user = User.query.filter_by(username=username_or_token).first() |
||
18 | return g.user is not None and g.user.verify_password(password) |
||
19 | |||
24 |