Exemple #1
0
    def post(self):
        parser = reqparse.RequestParser()
        parser.add_argument("wallet",
                            type=wallet_is_valid,
                            required=True)

        parser.add_argument("password",
                            type=str,
                            required=True)

        parser.add_argument("confirmation",
                            type=str,
                            required=True)

        parser.add_argument("email",
                            type=str,
                            default=None,
                            required=False)

        args = parser.parse_args()

        player = Player()
        player.wallet = args.get('wallet')
        player.set_password(args.get('password'))

        player.email = args.get('email')
        player.active = True

        player.save()
        login_user(player, remember=True)

        return player
Exemple #2
0
    def post(self):
        form = SignupForm()
        if form.validate_on_submit():
            player = Player()
            player.wallet = form.wallet.data
            player.email = form.email.data
            player.active = True

            player.set_password(form.password.data)
            player.save()

            login_user(player, remember=True)
            flash("User signup successfully...")
            return redirect(request.args.get("next") or url_for("index"))

        return render_template("signup.html", form=form)