mirror of
https://github.com/Xevion/runnerspace.git
synced 2025-12-07 03:16:22 -06:00
Revamp all model relationships to use backref attributes properly
- Fix new post form not including a CSRF token - Removed some old leftover comment profanity validation, changed to validate_on_submit() for first time - Include rest of pluralize macro work with this commit + used pluralizing logic where there once was none
This commit is contained in:
9
auth.py
9
auth.py
@@ -14,7 +14,7 @@ def edit_profile_post(username: str):
|
||||
form = EditProfileForm(request.form)
|
||||
user = User.query.filter_by(username=username).first_or_404()
|
||||
|
||||
if current_user.is_admin or user.id == current_user.id:
|
||||
if current_user.is_admin or user == current_user:
|
||||
if form.validate():
|
||||
user.about_me = form.about_me.data
|
||||
db.session.commit()
|
||||
@@ -24,6 +24,9 @@ def edit_profile_post(username: str):
|
||||
|
||||
@blueprint.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
if current_user.is_authenticated:
|
||||
return redirect(url_for('main.index'))
|
||||
|
||||
form = LoginForm(request.form)
|
||||
|
||||
if request.method == 'POST' and form.validate():
|
||||
@@ -44,7 +47,9 @@ def login():
|
||||
|
||||
@blueprint.route('/signup', methods=['GET', 'POST'])
|
||||
def signup():
|
||||
# validate and add user to db
|
||||
if current_user.is_authenticated:
|
||||
return redirect(url_for('main.index'))
|
||||
|
||||
form = RegistrationForm(request.form)
|
||||
|
||||
if request.method == 'POST' and form.validate():
|
||||
|
||||
Reference in New Issue
Block a user