From 03df0b8a6d1285fa4aa17e6c4216dd2716a9ac47 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 3 Jan 2019 21:18:10 -0800 Subject: account page and renaming --- python/fatcat_web/auth.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'python/fatcat_web/auth.py') diff --git a/python/fatcat_web/auth.py b/python/fatcat_web/auth.py index 385f5c49..c6e6f04c 100644 --- a/python/fatcat_web/auth.py +++ b/python/fatcat_web/auth.py @@ -1,10 +1,17 @@ from flask import Flask, render_template, send_from_directory, request, \ - url_for, abort, g, redirect, jsonify, session -from fatcat_web import login_manager, api + url_for, abort, g, redirect, jsonify, session, flash +from fatcat_web import login_manager, api, Config from flask_login import logout_user, login_user, UserMixin import pymacaroons +import fatcat_client +def auth_api(token): + conf = fatcat_client.Configuration() + conf.api_key["Authorization"] = token + conf.api_key_prefix["Authorization"] = "Bearer" + conf.host = Config.FATCAT_API_HOST + return fatcat_client.DefaultApi(fatcat_client.ApiClient(conf)) def handle_logout(): logout_user() @@ -31,7 +38,7 @@ def handle_token_login(token): session['api_token'] = token session['editor'] = editor login_user(load_user(editor_id)) - return redirect("/") + return redirect("/auth/account") # This will need to login/signup via fatcatd API, then set token in session def handle_oauth(remote, token, user_info): @@ -70,6 +77,7 @@ def load_user(editor_id): token = session['api_token'] user = UserMixin() user.id = editor_id + user.editor_id = editor_id user.username = editor['username'] user.token = token return user -- cgit v1.2.3