added password creation page
This commit is contained in:
parent
3910fcf0a6
commit
d17093ab3e
2 changed files with 46 additions and 8 deletions
23
templates/create_password.html
Normal file
23
templates/create_password.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Curious Greg - Create Password</title>
|
||||
{% include 'imports.html' %}
|
||||
</head>
|
||||
<body>
|
||||
<h1>Create password</h1>
|
||||
<h2>Please enter a password for your new Curious Greg account.</h2>
|
||||
<noscript>
|
||||
Curious Greg will not function without JavaScript. Please ensure you have JavaScript enabled.
|
||||
</noscript>
|
||||
<!-- <div id='logo-main'></div> -->
|
||||
<form action='/internal/do_login' method='POST'>
|
||||
<label for='pw'>Password</label><br />
|
||||
<input type='password' name='pw' placeholder='••••••••' required /><br />
|
||||
<label for='pw2'>Retype password</label><br />
|
||||
<input type='password' placeholder='••••••••' name='pw2' required /><br />
|
||||
<button>Create Account</button>
|
||||
</form>
|
||||
{% include 'footer.html' %}
|
||||
</body>
|
||||
</html>
|
31
web.py
31
web.py
|
@ -34,6 +34,22 @@ def home():
|
|||
else:
|
||||
return redirect(url_for('main'))
|
||||
|
||||
|
||||
@app.route('/debug') #TODO: remove this before making the site live ;p
|
||||
def print_debug_info():
|
||||
return json.dumps(session._get_current_object())
|
||||
|
||||
@app.route('/login')
|
||||
def log_in():
|
||||
if 'acct' in session:
|
||||
#user is probably already logged in. if they aren't, home() will handle things and redirect them back here
|
||||
return redirect(url_for('home'))
|
||||
return render_template("login.html")
|
||||
|
||||
# return(json.dumps(client_info))
|
||||
|
||||
#internal stuff
|
||||
|
||||
@app.route('/internal/auth_a')
|
||||
def internal_auth_a():
|
||||
|
||||
|
@ -70,16 +86,15 @@ def internal_auth_b():
|
|||
if c.execute("SELECT COUNT(*) FROM data WHERE username LIKE ? AND instance LIKE ?", (session['username'], session['instance_url'])).fetchone()[0] > 0:
|
||||
#user already has an account with CG
|
||||
return redirect(url_for('log_in'))
|
||||
|
||||
c.execute("INSERT INTO data (username, instance, secret, appid, appsecret) VALUES (?, ?, ?, ?, ?)", (session['username'], session['instance_url'], session['secret'], session['client_id'], session['client_secret']))
|
||||
db.commit()
|
||||
return redirect(url_for('home'))
|
||||
|
||||
@app.route('/debug')
|
||||
def print_debug_info():
|
||||
return json.dumps(session._get_current_object())
|
||||
@app.route('/internal/do_login')
|
||||
def do_login():
|
||||
pass
|
||||
|
||||
@app.route('/login')
|
||||
def log_in():
|
||||
return render_template("login.html")
|
||||
|
||||
# return(json.dumps(client_info))
|
||||
@app.route('/create_password')
|
||||
def create_password():
|
||||
return render_template("create_password.html")
|
Loading…
Reference in a new issue