@ -10,7 +10,7 @@ from flask_login import LoginManager, login_required, login_user, logout_user, U
from flask_wtf import CSRFProtect
from flask_wtf import CSRFProtect
from db import get_db , get_registration_codes , add_registration_code , \
from db import get_db , get_registration_codes , add_registration_code , \
expire_registration_code , delete_registration_code
expire_registration_code , delete_registration_code , get_registered_users
from forms import RegistrationForm , LoginForm , RegistrationCodeForm , \
from forms import RegistrationForm , LoginForm , RegistrationCodeForm , \
ExpireRegistrationCodeForm
ExpireRegistrationCodeForm
@ -93,6 +93,8 @@ def registration():
form = RegistrationForm ( )
form = RegistrationForm ( )
if form . validate_on_submit ( ) :
if form . validate_on_submit ( ) :
return redirect ( ' /success ' )
return redirect ( ' /success ' )
if ' registrationCode ' in request . values :
form . registration_code . data = request . values [ ' registrationCode ' ]
return render_template ( ' register.html ' , form = form )
return render_template ( ' register.html ' , form = form )
@ -101,7 +103,8 @@ def registration():
def admin_index ( ) :
def admin_index ( ) :
context = {
context = {
' add_registration_code_form ' : RegistrationCodeForm ( ) ,
' add_registration_code_form ' : RegistrationCodeForm ( ) ,
' registration_codes ' : get_registration_codes ( )
' registration_codes ' : get_registration_codes ( ) ,
' registered_users ' : get_registered_users ( )
}
}
return render_template ( ' admin.html ' , * * context )
return render_template ( ' admin.html ' , * * context )