def settings():
if request.method == 'POST':
email = request.form['email']
curpassword = request.form['curpassword']
password = request.form['password']
phone = flask.request.form['phone']
pi_id = flask.request.form['piid']
room_name = flask.request.form['room_name']
capture_framerate = flask.request.form['capture_framerate']
output_framerate = flask.request.form['output_framerate']
threshold_frame_count = flask.request.form['threshold_frame_count']
current_user = User.query.filter_by(id=flask_login.current_user.id).first()
if pi_id == 'true':
current_user.pi_id = str(uuid.uuid4())
if current_user.check_password(curpassword) and password is not '':
current_user.passhash = generate_password_hash(password)
current_user.email = email
current_user.phone = phone
pi_data = Pi.query.filter_by(id=flask_login.current_user.id).first()
pi_data.room_name = room_name
pi_data.capture_framerate = capture_framerate
pi_data.output_framerate =output_framerate
pi_data.threshold_frame_count = threshold_frame_count
flag=Flags.query.filter_by(id=flask_login.current_user.id).first()
flag.request_update_settings = True
db.session.commit()
return redirect('settings')
return render_template('settings.html', user_data = flask_login.current_user, pi_data = Pi.query.filter_by(id=flask_login.current_user.id).first())
评论列表
文章目录