Validate registration process. Change copyright year.

This commit is contained in:
Khanh Ngo 2018-04-18 13:16:02 +07:00
parent bd45c4ef87
commit 3d8d94f280
3 changed files with 6 additions and 3 deletions

View File

@ -116,7 +116,7 @@
</div> </div>
<!-- /.login-box-body --> <!-- /.login-box-body -->
<div class="login-box-footer"> <div class="login-box-footer">
<center><p>2016 &copy; Khanh Ngo</p></center> <center><p>2018 &copy; Khanh Ngo</p></center>
</div> </div>
</div> </div>
<!-- /.login-box --> <!-- /.login-box -->

View File

@ -84,7 +84,7 @@
</div> </div>
<!-- /.form-box --> <!-- /.form-box -->
<div class="login-box-footer"> <div class="login-box-footer">
<center><p>2016 &copy; Khanh Ngo</p></center> <center><p>2018 &copy; Khanh Ngo</p></center>
</div> </div>
</div> </div>
<!-- /.login-box --> <!-- /.login-box -->

View File

@ -389,13 +389,16 @@ def login():
login_user(user, remember = remember_me) login_user(user, remember = remember_me)
return redirect(request.args.get('next') or url_for('index')) return redirect(request.args.get('next') or url_for('index'))
else: else:
if not username or not password or not email:
return render_template('register.html', error='Please input required information')
# registration case # registration case
user = User(username=username, plain_text_password=password, firstname=firstname, lastname=lastname, email=email) user = User(username=username, plain_text_password=password, firstname=firstname, lastname=lastname, email=email)
# TODO: Move this into the JavaScript # TODO: Move this into the JavaScript
# validate password and password confirmation # validate password and password confirmation
if password != rpassword: if password != rpassword:
error = "Passsword and confirmation do not match" error = "Password confirmation does not match"
return render_template('register.html', error=error) return render_template('register.html', error=error)
try: try: