Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route('/admin', methods=["GET","POST"])
- @login_required
- def admin():
- if current_user.is_authenticated and current_user.is_admin:
- notes = ['campaign.txt', 'player1.txt', 'player2.txt']
- selected_note = 'campaign.txt'
- if request.method == 'POST' and request.form.get('note'):
- selected_note = request.form.get('note')
- path = os.path.join('notes', selected_note)
- path = remove_dot_slash_recursive(path)
- if allowed_path(path):
- try:
- file = open(path, 'r')
- note_content = file.readlines()
- except Exception as e:
- note_content = ['This note does not exist\n']
- return render_template('admin.html', notes=notes, note_content=note_content, selected_note=selected_note)
- return redirect('troll')
- else:
- return 'You are not the master!:('
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement