Add interface for registering

This commit is contained in:
James Wang 2015-12-24 20:37:49 -05:00
parent d62415b513
commit 2680034587
3 changed files with 37 additions and 12 deletions

View file

@ -15,7 +15,7 @@ with app.app_context():
db.init_app(app) db.init_app(app)
db.create_all() db.create_all()
app.secret_key = config.SECRET app.secret_key = config.SECRET_KEY
app.config["SQLALCHEMY_DATABASE_URI"] = config.SQLALCHEMY_DATABASE_URI app.config["SQLALCHEMY_DATABASE_URI"] = config.SQLALCHEMY_DATABASE_URI
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = config.SQLALCHEMY_TRACK_MODIFICATIONS app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = config.SQLALCHEMY_TRACK_MODIFICATIONS

View file

@ -1,15 +1,16 @@
import os import os
with open(".secret_key", "a+") as secret: secret = open(".secret_key", "a+b")
if not secret.read(): contents = secret.read()
secret.seek(0) if not contents:
key = os.urandom(128) key = os.urandom(128)
secret.write(key) secret.write(key)
secret.flush() secret.flush()
else: else:
key = secret.read() key = contents
secret.close()
SECRET = key SECRET_KEY = key
SQLALCHEMY_DATABASE_URI = "mysql://root:i_hate_passwords@localhost/easyctf" SQLALCHEMY_DATABASE_URI = "mysql://root:i_hate_passwords@localhost/easyctf"
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False

View file

@ -1,5 +1,7 @@
<h1 class="ui dividing header">Register</h1> <h1 class="ui dividing header">Register</h1>
<form class="ui form"> <script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script src="js/register.js"></script>
<form id="registration-form" class="ui form">
<div class="field"> <div class="field">
<div class="two fields"> <div class="two fields">
<div class="field"> <div class="field">
@ -11,5 +13,27 @@
<input type="email" name="email" id="email" autocomplete="off" placeholder="Email"> <input type="email" name="email" id="email" autocomplete="off" placeholder="Email">
</div> </div>
</div> </div>
<div class="two fields">
<div class="field">
<label>Username</label>
<input type="text" name="username" id="username" autocomplete="off" placeholder="Username">
</div>
<div class="field">
<label>Password</label>
<input type="password" name="password" id="password" autocomplete="off" placeholder="Password">
</div>
</div>
<div class="two fields">
<div class="field">
<label>Password</label>
<input type="password" name="password_confirm" id="password_confirm" autocomplete="off" placeholder="Confirm Password">
</div>
<div class="field">
<label>Captcha</label>
<div class="g-recaptcha" data-sitekey="6Lc4xhMTAAAAAIaiF3yEWGbHRaGgMg4FHor61p1G"></div>
</div>
</div>
</div> </div>
</div> <div id="status"></div>
<input type="submit" class="ui fluid large teal submit button" value="Register">
</form>