コード例 #1
0
def home():
    """Home page."""
    form = LoginForm(request.form)
    current_app.logger.info("Hello from the home page!")
    # Handle logging in
    if request.method == "POST":
        if form.validate_on_submit():
            login_user(form.user)
            flash("You are logged in.", "success")
            redirect_url = request.args.get("next") or url_for("user.members")
            return redirect(redirect_url)
        else:
            flash_errors(form)
    return render_template("public/home.html", form=form)
コード例 #2
0
def register():
    """Register new user."""
    form = RegisterForm(request.form)
    if form.validate_on_submit():
        User.create(
            username=form.username.data,
            email=form.email.data,
            password=form.password.data,
            active=False,
        )
        flash("感谢注册,请联系管理员激活账号!", "success")
        return redirect(url_for("public.home"))
    else:
        flash_errors(form)
    return render_template("public/register.html", form=form)
コード例 #3
0
def home():
    """Home page."""
    form = LoginForm(request.form)
    current_app.logger.info("Hello from the home page!")
    # Handle logging in
    if request.method == "POST":
        if form.validate_on_submit():
            login_user(form.user)
            flash("You are logged in.", "success")
            redirect_url = request.args.get("next") or url_for("user.members")
            return redirect(redirect_url)
        else:
            flash_errors(form)
    # TODO
    mock_data_type = ["byte32", "int", "bytes"]
    key_type = ["bitcoin", "ethereum"]
    trans_type = ["signature"]
    return render_template(
        "public/home.html",
        form=form,
        mock_data_type=mock_data_type,
        trans_type=trans_type,
        key_type=key_type,
    )
コード例 #4
0
ファイル: public.py プロジェクト: wqgalex1/FISCO-BCOS-Toolbox
def home():
    """Home page."""
    form = LoginForm(request.form)
    current_app.logger.info("Hello from the home page!")
    # Handle logging in
    if request.method == "POST":
        if form.validate_on_submit():
            login_user(form.user)
            flash("You are logged in.", "success")
            redirect_url = request.args.get("next") or url_for("user.members")
            return redirect(redirect_url)
        else:
            flash_errors(form)
    # TODO
    mock_data_type = ["byte32", "int", "bytes"]
    key_type = ["bitcoin", "ethereum"]
    trans_type = ["signature"]

    contracts = Contract.query.all()

    for contract in contracts:
        # load contract by path
        files = os.listdir(contract.path)
        payload = {}
        for file in files:
            f = open(contract.path + "/" + file).read()
            payload[file] = f
        contract.payload = payload
    return render_template(
        "public/home.html",
        form=form,
        mock_data_type=mock_data_type,
        trans_type=trans_type,
        key_type=key_type,
        contracts=contracts,
    )