initial functionality and styling pass

This commit is contained in:
Bryan Van Deusen
2025-07-29 00:34:03 -04:00
parent 1590ca72c1
commit c67f1afc1f
1763 changed files with 876 additions and 76 deletions
+18 -2
View File
@@ -15,11 +15,27 @@ def register():
form = RegistrationForm()
if form.validate_on_submit():
hashed_password = generate_password_hash(form.password.data)
user = User(username=form.username.data, email=form.email.data, password_hash=hashed_password)
# Check if any users exist
is_first_user = User.query.count() == 0
user = User(
username=form.username.data,
email=form.email.data,
password_hash=hashed_password,
is_admin=is_first_user # Make first user an admin
)
db.session.add(user)
db.session.commit()
flash('Account created! Please log in.', 'success')
if is_first_user:
flash('Account created as administrator.', 'success')
else:
flash('Account created! Please log in.', 'success')
return redirect(url_for('auth.login'))
return render_template('register.html', form=form)
@auth.route('/login', methods=['GET', 'POST'])