Grant automatically if user has unrevoked token for specified client
parent
bebd9b0db8
commit
3c9d0dc919
6
auth.py
6
auth.py
|
@ -218,6 +218,12 @@ def save_token(token, request, *args, **kwargs):
|
|||
def authorize(*args, **kwargs):
|
||||
form = FlaskForm()
|
||||
|
||||
if Token.query.filter(
|
||||
Token.client_id == kwargs.get('client_id'),
|
||||
Token.user == current_user.username).count():
|
||||
# User has unrevoked token already - grant by default
|
||||
return True
|
||||
|
||||
if not form.validate_on_submit():
|
||||
client_id = kwargs.get('client_id')
|
||||
client = Client.query.filter_by(client_id=client_id).first()
|
||||
|
|
Loading…
Reference in New Issue