Example #1
0
def site_index():
    if is_ta():
        return redirect(url_for("ta.index"), code=302)
    elif user_id():
        return redirect(url_for("dashboard.index"), code=302)
    else:
        return redirect(url_for("onboarding.log_in"), code=302)
Example #2
0
def site_index():
    if is_ta():
        return redirect(url_for("ta.index"), code=302)
    elif user_id():
        return redirect(url_for("dashboard.index"), code=302)
    else:
        return redirect(url_for("onboarding.log_in"), code=302)
Example #3
0
 def wrapped(*args, **kwargs):
     if not is_ta():
         if request.method == "GET":
             session["login_next__ta"] = request.base_url
         elif "login_next__ta" in session:
             del session["login_next__ta"]
         return redirect(url_for("onboarding.log_in"))
     else:
         if "login_next__ta" in session:
             del session["login_next__ta"]
         return fn(*args, **kwargs)
Example #4
0
 def wrapped(*args, **kwargs):
     if not is_ta():
         if request.method == "GET":
             session["login_next__ta"] = request.base_url
         elif "login_next__ta" in session:
             del session["login_next__ta"]
         return redirect(url_for("onboarding.log_in"))
     else:
         if "login_next__ta" in session:
             del session["login_next__ta"]
         return fn(*args, **kwargs)
Example #5
0
def _get_current_step():
    if is_ta():
        return "ta.index"
    if user_id():
        return "dashboard.index"
    github = github_username()
    if not github:
        return "onboarding.log_in"
    with DbCursor() as c:
        user = get_user_by_github(c, github)
        if not user:
            return "onboarding.student_id"
        user_id_, _, _, _, _, _ = user
        if config.student_photos_enabled:
            photo = get_photo(c, user_id_)
            if not photo:
                return "onboarding.photo"
        authenticate_as_user(user_id_)
        return "dashboard.index"
Example #6
0
def _get_current_step():
    if is_ta():
        return "ta.index"
    if user_id():
        return "dashboard.index"
    github = github_username()
    if not github:
        return "onboarding.log_in"
    with DbCursor() as c:
        user = get_user_by_github(c, github)
        if not user:
            return "onboarding.student_id"
        user_id_, _, _, _, _, _ = user
        if config.student_photos_enabled:
            photo = get_photo(c, user_id_)
            if not photo:
                return "onboarding.photo"
        authenticate_as_user(user_id_)
        return "dashboard.index"
Example #7
0
def _template_common(c):
    return {"student": _get_student(c),
            "is_ta": is_ta(),
            "groups_enabled": config.groups_enabled}
Example #8
0
def _template_common(c):
    return {
        "student": _get_student(c),
        "is_ta": is_ta(),
        "groups_enabled": config.groups_enabled
    }