def password_update_form(): #WORKS
    """
    In GET request
        - Redirects to login page if not logged in.
        - Displays the password update form.
    """
    if request.method == 'GET':
        u_error = request.args.get('u_error', False)
        if 'user' not in session:
            return redirect(url_for('login_form'))
        is_admin = (requests.get(url='http://127.0.0.1:8080/is-admin/{}'.format(session['user'])).content).decode("utf-8") # Done
        if is_admin == "True":
            abort(403)
        password_update_page = ((requests.get(url='http://127.0.0.1:8080/html/{}'.format('password_update.html'))).content).decode("utf-8") # Done
        if u_error == False:
            return render_template_string(password_update_page)
        else:
            return render_template_string(password_update_page, update_error = True)
    """
    In POST request
        - Gets the old and new passwords.
        - Checks the old password.
        - If it matches the stored password, password is updated.
        - Otherwise, error is thrown.
    """
    if request.method == 'POST':
        if 'user' not in session:
            return redirect(url_for('login_form'))
        is_admin = (requests.get(url='http://127.0.0.1:8080/is-admin/{}'.format(session['user'])).content).decode("utf-8") # Done
        if is_admin == "True":
            abort(403)
        username = session['user']
        old_password = request.form['oldPassword']
        new_password = request.form['newPassword']
        done = (requests.post(url='http://127.0.0.1:8080/update-password', data={'username' : username, 'old_password' : old_password, 'new_password' : new_password}).content).decode("utf-8") # Done
        if done == "True":
            return redirect(url_for('start'))
        else:
            return redirect(url_for('password_update_form', u_error = True))