def request_account_submit():
    """Handles an account creation request."""
    uid = flask.request.form.get("uid", None)
    last_name = flask.request.form.get("last_name", None)
    if uid is None or last_name is None:
        flask.flash("Invalid request.")
        return flask.redirect(flask.url_for("account.request_account"))

    success, error_msg = helpers.handle_request_account(uid, last_name)
    if success:
        flask.flash(
            "An email has been sent with a link to create your account.")
        return flask.redirect(flask.url_for("home"))
    else:
        flask.flash(error_msg)
        return flask.redirect(flask.url_for("account.request_account"))