Reputation: 29
Basically I'm trying to create a view that lets the user update his password.
Code below.
@app.route('/update_login_info/<password>',methods=['GET','POST'])
def update_login_info(password):
form = forms.UpdateLoginForm()
if form.validate_on_submit():
try:
query=models.User.update(password=models.generate_password_hash(form.new_password.data),)
query.execute()
flash("login info updated","success")
return redirect(url_for('login'))
except:
flash("error updating login info","error")
return redirect(url_for('login'))
return render_template('update_login_info.html',form=form)
every time i get to the route flask throws a 404 and i cannot work out why.
When the user clicks on a link in their email the route looks like this http://chdbfiletransferapp/update_login_info/$2a$12$HdJJbOUwALvtUjrlKhIrYeJdMO3nws0hAQ94/6I/dU8IaSAtdU6W6
Upvotes: 0
Views: 163
Reputation: 6881
Use path converter to accept slashes:
@app.route('/update_login_info/<path:password>',methods=['GET','POST'])
Upvotes: 2