From df9391f5bd21a2546e1d4d0e782728b646c8ce39 Mon Sep 17 00:00:00 2001 From: Lynne Date: Mon, 12 Nov 2018 20:41:03 +1000 Subject: [PATCH] CSS changes, more curious cat connection stuff --- static/style.css | 24 +++++++++++++++++++++++- templates/cc_connect_confirm.html | 7 ++++--- web.py | 27 ++++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/static/style.css b/static/style.css index 7686c4b..7d3bffb 100644 --- a/static/style.css +++ b/static/style.css @@ -30,12 +30,15 @@ h2 { height:300px; width:300px; } -form, .profilecard { +form, .profilecard, #question, #codebox { background-color: #444b5d; display:inline-block; padding:50px; border-radius:5px; font-size:1.4em; + min-width:250px; + max-width: 60vw; + line-height: 1.4em; } .profilecard { padding: 30px; @@ -45,6 +48,9 @@ form, .profilecard { white-space: nowrap; text-overflow:ellipsis; } +#codebox { + font-size: 1.2em; +} input { margin:20px; font-size:1.2em; @@ -60,11 +66,17 @@ button, .button { transition:0.2s all ease-in; cursor: pointer; text-decoration:none; + display:inline-block; + margin: 5px 0; } button:hover, .button:hover{ background-color:#2b90d9; color:white; } +button.fullwidth, .button.fullwidth { + width:100%; + box-sizing: border-box; +} #form-avi, .pc-avi { height: 128px; width:128px; @@ -85,3 +97,13 @@ button:hover, .button:hover{ font-size: 1.2em; line-height:2.6em; } +.code { + background-color: white; + color: black; + font-size: 3em; + font-family: monospace; + display: inline-block; + padding: 15px; + border-radius: 10px; + margin: 15px; +} \ No newline at end of file diff --git a/templates/cc_connect_confirm.html b/templates/cc_connect_confirm.html index 821e744..433ed40 100644 --- a/templates/cc_connect_confirm.html +++ b/templates/cc_connect_confirm.html @@ -8,10 +8,11 @@

Connect to Curious Cat

+ Continue with this account?

- Is this you?
- Yes
- No +
{{ session['cctemp']['cc'] }}

+ Yes
+ No
{% include 'footer.html' %} diff --git a/web.py b/web.py index 13f264b..491ce76 100755 --- a/web.py +++ b/web.py @@ -4,7 +4,9 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -import requests, json, hashlib, urllib, time, re +#TODO: ADD RETROSPRING SUPPORT! + +import requests, json, hashlib, urllib, time, re, random from mastodon import Mastodon from flask import Flask, render_template, request, session, redirect, url_for import mysql.connector @@ -194,7 +196,30 @@ def ccc_a(): #step one of curiouscat connection: retreive details "ccavi":j['userData']['avatar'], "ccid":j['userData']['id'] } + return redirect('/cc_connect/confirm') @app.route('/cc_connect/confirm') def cc_connect_confirm(): return render_template('cc_connect_confirm.html', bg="background-image:url('{}')".format(session['cctemp']['ccavi'])) + +@app.route('/internal/ccc_b') +def ccc_b(): + session['cctemp']['challenge'] = random.randint(100000, 999999) #provided by CG + session['cctemp']['response'] = random.randint(100000, 999999) #user will be asked to answer with this code to prove it's really them + session.modified = True + form_data = { + "addressees": session['cctemp']['ccid'], + "anon": "true", + "question": "Hi! Please respond to this question with the code given to you by Curious Greg. If you did not request this code, you may safely delete this question. Challenge: {}".format(session['cctemp']['challenge']) + } + r = requests.post("https://curiouscat.me/api/v2/post/create", data=form_data) + j = r.json() + if 'success' in j and j['success'] == True: + return redirect('/cc_connect/code') + else: + #todo: handle error properly + return False + +@app.route('/cc_connect/code') +def cc_connect_code(): + return render_template('cc_connect_code.html')