def generate_access_token(request): if not request.user['is_authenticated']: return redirect('users.views.login') username = request.session['username'] add_user_metadata(request, username, access_token=base64.urlsafe_b64encode(os.urandom(32)), access_secret=base64.urlsafe_b64encode(os.urandom(32))) return redirect('users.views.profile', username=request.session['username'])
def remove_access_token(request): if not request.user['is_authenticated']: return redirect('users.views.login') username = request.session['username'] add_user_metadata(request, username, access_token='', access_secret='') return redirect('users.views.profile', username=request.session['username'])