def room_password(room_id): """Show the password form. Authenticate the password for the room with id of room_id.""" # If no one is logged in, show the anon home page. if not g.user: return render_template("home-anon.html") form = RoomForm() # If conditional will return true when the form submits a response if form.validate_on_submit(): room = Room.authenticate(id=room_id, password=form.password.data) if room: return redirect(f"/room/{room.id}") flash("Invalid credentials.", 'danger') return render_template("/room/password.html", form=form)