def profile():
    message = None
    global notifications
    if notifications:
        message = notifications
        notifications = None
    if 'uid' not in session:
        return redirect(url_for('login'))

    result = Users.userprofile(db, request.form)
    print (result[0])
    return render_template('userprofile.html', data=result[0])
def changepassword():
    print('in change password function')
    #result = Users.changepassword(db.conn, None)
    if request.method == 'POST':
        result = Users.changepassword(db, request.form)
        result1 = Users.userprofile(db, request.form)
        if not result:
            message = {'message': 'Username/Password Changed', 'type': 'success'}
            return render_template('userprofile.html', data=result1[0], message=message)
        else:
            message = {'message': 'Username/Password change Failed', 'type': 'error'}
            return render_template('userprofile.html', data=result1[0], message=message)
        return render_template('userprofile.html', data=result1[0])
    return render_template('changepwd.html')