Esempio n. 1
0
File: mobile.py Progetto: kzkn/fc
def login():
    if request.method == "POST":
        password = request.form["password"]
        (uid, sid) = do_mobile_login(password)
        if uid is not None:
            return redirect(mobile_url_for("mobile.index", uid=uid, sid=sid))
    return render_template("mobile/login.html")
Esempio n. 2
0
File: mobile.py Progetto: kzkn/fc
def index():
    user = users.find_by_id(get_userid())
    if user.has_not_registered_schedule_yet():
        return redirect(mobile_url_for("mobile.non_registered_practices"))
    ns = notices.find_showing()
    practice_count = scheds.count_schedules(scheds.TYPE_PRACTICE)
    game_count = scheds.count_schedules(scheds.TYPE_GAME)
    event_count = scheds.count_schedules(scheds.TYPE_EVENT)
    return render_template(
        "mobile/index.html",
        user=user,
        notices=ns,
        practice_count=practice_count,
        game_count=game_count,
        event_count=event_count,
    )
Esempio n. 3
0
File: mobile.py Progetto: kzkn/fc
def bbs_post():
    body = request.form["body"]
    bbsmodel.post(body)
    return redirect(mobile_url_for("mobile.bbs"))
Esempio n. 4
0
File: mobile.py Progetto: kzkn/fc
@mod.route("/profile", methods=["GET", "POST"])
@requires_userid
def profile():
    if request.method == "GET":
        return render_template("mobile/profile.html")

    try:
        validate_profile()
        id = get_userid()
        users.update_profile(id, request.form)
    except ValueError, e:
        return render_template("mobile/profile.html", errors=e.errors)
    except users.NotUniquePassword:
        return render_template("mobile/profile.html", errors=dict(password=u"被ってるっぽいので別のにしてください"))

    return redirect(mobile_url_for("mobile.profile"))


@mod.route("/notice/<int:id>")
@requires_userid
def notice(id):
    notice = notices.find_by_id(id)
    return render_template("mobile/notice.html", notice=notice)


@mod.route("/rule")
@requires_userid
def rule():
    rs = rules.find_all()
    return render_template("mobile/rule.html", rules=rs)