Allow editor to edit any character

In particular, this allows th editor to edit the default character
This commit is contained in:
Tim Van Baak 2020-01-31 14:02:08 -08:00
parent 6c244b084c
commit 19263040a9
1 changed files with 3 additions and 4 deletions

View File

@ -32,8 +32,6 @@ def get_bp():
# Gate on password if one is required # Gate on password if one is required
if (g.lexicon.join.password if (g.lexicon.join.password
and form.password.data != g.lexicon.join.password): and form.password.data != g.lexicon.join.password):
flash("Incorrect password")
print("redirecting")
return redirect(url_for("lexicon.join", name=name)) return redirect(url_for("lexicon.join", name=name))
# Gate on join validity # Gate on join validity
if valid_add(g.lexicon, current_user, form.password.data): if valid_add(g.lexicon, current_user, form.password.data):
@ -41,7 +39,7 @@ def get_bp():
return redirect(url_for("lexicon.session", name=name)) return redirect(url_for("lexicon.session", name=name))
else: else:
flash("Could not join game") flash("Could not join game")
return redirect(url_for("lexicon.join", name=name)) return redirect(url_for("home.home", name=name))
return render_template('lexicon/join.html', form=form) return render_template('lexicon/join.html', form=form)
@ -101,7 +99,8 @@ def get_bp():
if cid not in g.lexicon.character: if cid not in g.lexicon.character:
flash('Character not found') flash('Character not found')
return redirect(url_for('lexicon.session', name=name)) return redirect(url_for('lexicon.session', name=name))
if g.lexicon.character.get(cid).player != current_user.id: if (g.lexicon.character.get(cid).player != current_user.id
and g.lexicon.editor != current_user.id):
flash('Access denied') flash('Access denied')
return redirect(url_for('lexicon.session', name=name)) return redirect(url_for('lexicon.session', name=name))
return edit_character(name, form, cid) return edit_character(name, form, cid)