CSS changes, more curious cat connection stuff

This commit is contained in:
Lynne Megido 2018-11-12 20:41:03 +10:00
parent aba36cb079
commit df9391f5bd
Signed by: lynnesbian
GPG Key ID: FB7B970303ACE499
3 changed files with 53 additions and 5 deletions

View File

@ -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;
}

View File

@ -8,10 +8,11 @@
<h1>Connect to Curious Cat</h1>
<!-- <div id='logo-main'></div> -->
<div id='question'>
Continue with this account?<br /><br />
<div id='form-avi' style={{ bg }}></div>
Is this you?<br />
<a class='button' href='/internal/ccc_b'>Yes</a><br />
<a class='button' href='/cc_connect'>No</a>
<div id='form-avi-label'>{{ session['cctemp']['cc'] }}</div><br />
<a class='button fullwidth' href='/internal/ccc_b'>Yes</a><br />
<a class='button fullwidth' href='/cc_connect'>No</a>
</div>
{% include 'footer.html' %}
</body>

27
web.py
View File

@ -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')