more curiouscat connection stuff

This commit is contained in:
Lynne Megido 2018-11-12 19:19:43 +10:00
parent affd824913
commit 6405336a58
Signed by: lynnesbian
GPG Key ID: FB7B970303ACE499

16
web.py
View File

@ -182,3 +182,19 @@ def create_account():
@app.route('/cc_connect')
def cc_connect():
return render_template('cc_connect.html')
@app.route('/internal/ccc_a', methods=['POST'])
def ccc_a(): #step one of curiouscat connection: retreive details
r = requests.get("https://curiouscat.me/api/v2/profile?username={}".format(request.form['cc']))
j = r.json()
if 'error' in j:
return redirect('/cc_connect?invalid')
session['cctemp'] = {
"cc":j['userData']['username'],
"ccavi":j['userData']['avatar'],
"ccid":j['userData']['id']
}
@app.route('/cc_connect/confirm')
def cc_connect_confirm():
return render_template('cc_connect_confirm.html', bg="background-image:url('{}')".format(session['cctemp']['ccavi']))