def delete_own_account(): #WORKS
    """
    In GET request
        - Displays confirmation page.
    """
    if request.method == 'GET':
        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)
        confirmation_error = request.args.get('c_error', False)
        confirmation_page = ((requests.get(url='http://127.0.0.1:8080/html/{}'.format('account_delete_confirm.html'))).content).decode("utf-8") # Done
        if confirmation_error == False:
            return render_template_string(confirmation_page)
        else:
            return render_template_string(confirmation_page, c_error = True)
    """
    In POST request
        - Deletes the user credentials from the database.
        - Redirects to login page.
    """
    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']
        password = request.form['password']
        is_deleted = ((requests.post(url='http://127.0.0.1:8080/delete-user', data={'username' : username, 'password' : password})).content).decode("utf-8") # Done
        if is_deleted == "True":
            session.pop('user', None)
            return redirect(url_for("login_form"))
        else:
            return redirect(url_for('delete_own_account', c_error = True))