Example #1
0
def submit_debug_login(username):
    log.info("%s - Signin clicked: %s", NAME, username)
    if authenticated_login_is_enabled():
        return "Debug logins are disabled."

    handle_login(username, "{}@email.com".format(username))
    session.set_post_login_redirect(href(__name__, debug_login_submit))
Example #2
0
def report_button():
    return dcc.Link(
        "Report",
        href=href(__name__),
        className="btn btn-primary btn-block btn-danger",
        id="report",
    )
Example #3
0
def layout():
    """
    Layout for debug login.
    """
    return html.Div(
        [
            html.H1("Metaswitch Tinder", className="text-center"),
            html.Br(),
            create_equal_row([
                html.Label("Username:"******"text-center"),
                dcc.Input(value="", type="text",
                          id="username-{}".format(NAME)),
            ]),
            html.Br(),
            dcc.Link(
                html.Button(
                    "Submit!",
                    id="submit-{}".format(NAME),
                    n_clicks=0,
                    className="btn btn-lg btn-primary btn-block",
                ),
                href=href(__name__, debug_login_submit),
            ),
        ],
        className="container",
        id="signin",
    )
Example #4
0
def login():
    if session.is_logged_in():
        redirect_target = flask.session.get("signin_redirect", "/")
    elif "GOOGLE_ID" in os.environ:
        redirect_target = flask.url_for("login_with_google")
    else:
        redirect_target = href(__name__, debug_login_target)
    return flask.redirect(redirect_target)
def submit_signup_information():
    log.info("%s - Signin clicked", NAME)

    # Make the default tab the mentor skills tab when signing in
    # as a mentor.
    session.set_last_tab_on(user_menu.NAME, "mentor")
    session.set_last_tab_on(mentor.NAME, "mentor_skills")
    session.set_post_login_redirect(href(__name__, signin))
Example #6
0
def submit_mentee_information(categories: List[str], details: str):
    print("mentee request", categories, details)

    if session.is_logged_in():
        database.models.create_request(session.current_user_email(),
                                       categories, details)
    else:
        session.store_signup_information("",
                                         request_categories=categories,
                                         request_details=details)
        session.set_post_login_redirect(href(__name__, submit_request))
Example #7
0
def layout():
    if session.is_logged_in():
        log.debug("%s: already logged in.", NAME)
        btn = (dcc.Link(
            html.Button(
                "Submit my request!",
                id=submit_button,
                className="btn btn-lg btn-success btn-block",
            ),
            href=href(__name__, submit_request),
        ), )
    else:
        log.debug("%s: not logged in.", NAME)
        btn = (html.A(
            html.Button(
                "Submit my request and sign up!",
                id=submit_button,
                className="btn btn-lg btn-success btn-block",
            ),
            href="/login",
        ), )

    return html.Div(
        [
            html.Label("What topics do you want to learn about?"),
            html.Br(),
            *tags_dropdown_with_add_new_entry_box(categories_id),
            html.Br(),
            html.Label(
                "Describe in more detail what you're looking for:",
                className="text-center text-dark",
            ),
            html.Br(),
            create_equal_row([
                dcc.Textarea(
                    value="",
                    id=details_id,
                    rows=6,
                    placeholder="Try starting with one of the following:\n"
                    "  I'd like a code review of...\n"
                    "  I'd like weekly mentoring sessions...\n"
                    "  I'm looking for a one off education session about...\n"
                    "  I want a running partner.\n"
                    "  I'm looking for someone to play chess with.",
                    maxLength=2000,
                )
            ]),
            html.Br(),
            html.Div(btn),
            html.Div(id="dummy-submit-{}".format(NAME)),
        ],
        className="container",
        id="mentee-request-div",
    )
Example #8
0
def edit_request_layout(request: Request):
    """Layout to display when a request has been selected to be edited."""
    log.debug("Displaying request edit page for request: %s", request)
    return html.Div(
        [
            html.Label("What topics do you want to learn about?"),
            html.Br(),
            *tags_dropdown_with_add_new_entry_box(tags_id, init_selection=request.tags),
            html.Br(),
            html.Label(
                "Any additional details about this request that the mentor "
                "should know?",
                className="text-center",
            ),
            html.Br(),
            create_equal_row([dcc.Textarea(value=request.comment, id=details_id)]),
            html.Br(),
            dcc.Link(
                html.Button(
                    "Save",
                    id=save_id,
                    n_clicks=0,
                    className="btn btn-lg btn-primary btn-block",
                ),
                href=href(__name__, save_id),
            ),
            html.Br(),
            html.Br(),
            dcc.Link(
                html.Button(
                    "Delete Request",
                    id=delete_id,
                    n_clicks=0,
                    className="btn btn-lg btn-warning btn-block",
                ),
                href=href(__name__, delete_id),
            ),
            html.Div(request.id, id=current_request_id, hidden=True),
        ],
        className="container",
    )
Example #9
0
def layout():
    return html.Div(
        [
            html.H1("Metaswitch Tinder", className="cover-heading"),
            html.P(
                "Metaswitch Tinder is a match-making service for informal mentoring "
                "and unofficial pastoral support "
                "at Metaswitch.",
                className="lead",
            ),
            create_equal_row([
                dcc.Link(
                    "Become a mentor!",
                    href=href(__name__, im_a_mentor),
                    className="btn btn-lg btn-info",
                ),
                dcc.Link(
                    "Become a mentee!",
                    href=href(__name__, im_a_mentee),
                    className="btn btn-lg btn-primary",
                ),
            ]),
            html.Br(),
            html.Br(),
            html.A(
                "I have an account - sign in.",
                href="/login",
                className="btn btn-primary",
                id=signin,
            ),
            html.Br(),
            html.Br(),
            about_div(),
            html.Div(id="dummy", hidden=True),
        ],
        className="container text-center",
    )
Example #10
0
def layout():
    return html.Div(
        [
            html.H1("Metaswitch Tinder", className="cover-heading"),
            create_equal_row([
                html.A(
                    "Sign in!",
                    href="/login",
                    id="signin-{}".format(NAME),
                    className="btn btn-lg btn-secondary",
                ),
                dcc.Link(
                    "Sign up!",
                    href=href(__name__, signup),
                    className="btn btn-lg btn-primary",
                ),
            ]),
        ],
        className="container text-center",
        id="signin-or-signup",
    )
Example #11
0
def layout():
    return html.Div(
        [
            html.H1("Report an issue", className="text-center"),
            html.Br(),
            html.H4("Found a bug? Want to request a feature?"),
            html.A(
                "Raise it on github!",
                href=
                "https://github.com/MartinHowarth/metaswitch-tinder/issues",
                className="lead",
            ),
            html.Br(),
            html.Br(),
            html.Br(),
            html.H4(
                "Want to report inappropriate content, or abuse, for review? "
                "Send us an email:"),
            dcc.Textarea(
                placeholder="Report an issue or inappropriate content.  "
                "Please include as much information as possible",
                value="",
                id="report-{}".format(NAME),
                style={"width": "100%"},
            ),
            dcc.Link(
                html.Button(
                    "Submit Report",
                    id="submit-{}".format(NAME),
                    n_clicks=0,
                    className="btn btn-sm btn-danger btn-block",
                ),
                href=href(__name__, submit),
            ),
        ],
        className="container text-center",
    )
Example #12
0
def submit_signup_information(biography, categories, details):
    session.store_signup_information(biography,
                                     mentor_categories=categories,
                                     mentor_details=details)
    session.set_post_login_redirect(href(__name__, submit))
Example #13
0
def submit_signup_information():
    log.debug("%s - Signin clicked", NAME)
    session.set_post_login_redirect(href(__name__, signin))
def submit_signup_information():
    log.debug("%s - %s clicked", NAME, "signin-{}".format(NAME))
    session.set_post_login_redirect(href(__name__, sign_in))
def submit_mentee_information():
    log.debug("%s - %a clicked", NAME, mentee_request.submit_button)
    session.set_post_login_redirect(
        href(__name__, mentee_request.submit_request))