profile
This commit is contained in:
18
shop.py
18
shop.py
@@ -408,6 +408,24 @@ def register():
|
||||
return redirect(url_for('login'))
|
||||
return render_template('register.html', error=error)
|
||||
|
||||
@app.route('/profile', methods=['GET', 'POST'])
|
||||
def profile():
|
||||
error = None
|
||||
if request.method == 'POST':
|
||||
import re, string
|
||||
pattern = re.compile('[\W]+')
|
||||
password=password_hash(request.form['password'])
|
||||
if len(request.form['password'])<5:
|
||||
error="Password too short"
|
||||
return render_template('profile.html', error=error)
|
||||
g.db.execute('update users set pass=? where id=?',
|
||||
[password,session.get('user')])
|
||||
g.db.commit()
|
||||
flash('successfully updated profile.')
|
||||
return redirect(url_for('profile'))
|
||||
return render_template('profile.html', error=error)
|
||||
|
||||
|
||||
|
||||
@app.route('/logout')
|
||||
def logout():
|
||||
|
||||
Reference in New Issue
Block a user