Add interface for registering
This commit is contained in:
parent
d62415b513
commit
2680034587
3 changed files with 37 additions and 12 deletions
|
@ -15,7 +15,7 @@ with app.app_context():
|
|||
db.init_app(app)
|
||||
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_TRACK_MODIFICATIONS"] = config.SQLALCHEMY_TRACK_MODIFICATIONS
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import os
|
||||
|
||||
with open(".secret_key", "a+") as secret:
|
||||
if not secret.read():
|
||||
secret.seek(0)
|
||||
key = os.urandom(128)
|
||||
secret.write(key)
|
||||
secret.flush()
|
||||
else:
|
||||
key = secret.read()
|
||||
secret = open(".secret_key", "a+b")
|
||||
contents = secret.read()
|
||||
if not contents:
|
||||
key = os.urandom(128)
|
||||
secret.write(key)
|
||||
secret.flush()
|
||||
else:
|
||||
key = contents
|
||||
secret.close()
|
||||
|
||||
SECRET = key
|
||||
SECRET_KEY = key
|
||||
|
||||
SQLALCHEMY_DATABASE_URI = "mysql://root:i_hate_passwords@localhost/easyctf"
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<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="two fields">
|
||||
<div class="field">
|
||||
|
@ -11,5 +13,27 @@
|
|||
<input type="email" name="email" id="email" autocomplete="off" placeholder="Email">
|
||||
</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 id="status"></div>
|
||||
<input type="submit" class="ui fluid large teal submit button" value="Register">
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue