예제 #1
0
    def test_validate_email_already_registered(self, user):
        # enters email that is already registered
        form = RegisterForm(username='******', email=user.email,
            password='******', confirm='example')

        assert form.validate() is False
        assert 'Email already registered' in form.email.errors
예제 #2
0
    def test_validate_user_already_registered(self, user):
        # Enters username that is already registered
        form = RegisterForm(username=user.username, email='*****@*****.**',
            password='******', confirm='example')

        assert form.validate() is False
        assert 'Username already registered' in form.username.errors
예제 #3
0
    def test_validate_user_already_registered(self, user):
        # Enters username that is already registered
        form = RegisterForm(username=user.username, email='*****@*****.**',
            password='******', confirm='example')

        assert form.validate() is False
        assert 'Username already registered' in form.username.errors
예제 #4
0
 def test_validate_success(self, db):
     """Register with success."""
     form = RegisterForm(username='******',
                         email='*****@*****.**',
                         password='******',
                         confirm='example')
     assert form.validate() is True
예제 #5
0
    def test_validate_email_already_registered(self, user):
        # enters email that is already registered
        form = RegisterForm(username='******', email=user.email,
            password='******', confirm='example')

        assert form.validate() is False
        assert 'Email already registered' in form.email.errors
예제 #6
0
 def test_validate_success(self, db):
     """Register with success."""
     form = RegisterForm(
         username="******",
         email="*****@*****.**",
         password="******",
         confirm="example",
     )
     assert form.validate() is True
예제 #7
0
    def test_validate_email_already_registered(self, user):
        """Enter email that is already registered."""
        form = RegisterForm(username="******",
                            email=user.email,
                            password="******",
                            confirm="example")

        assert form.validate() is False
        assert "Email already registered" in form.email.errors
예제 #8
0
def register():
    """Register new user."""
    form = RegisterForm(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        User.create(username=form.username.data, email=form.email.data, password=form.password.data, active=True)
        flash('Thank you for registering. You can now log in.', 'success')
        return redirect(url_for('public.home'))
    else:
        flash_errors(form)
    return render_template('public/register.html', form=form)
예제 #9
0
    def test_validate_user_already_registered(self, user):
        """Enter username that is already registered."""
        form = RegisterForm(
            username=user.username,
            email="*****@*****.**",
            password="******",
            confirm="example",
        )

        assert form.validate() is False
        assert "Username already registered" in form.username.errors
예제 #10
0
def register():
    form = RegisterForm(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        new_user = User.create(username=form.username.data,
                        email=form.email.data,
                        password=form.password.data,
                        active=True)
        flash("Thank you for registering. You can now log in.", 'success')
        return redirect(url_for('public.home'))
    else:
        flash_errors(form)
    return render_template('public/register.html', form=form)
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=True,
        )
        flash("Thank you for registering. You can now log in.", "success")
        return redirect(url_for("public.home"))
    else:
        flash_errors(form)
    return render_template("public/register.html", form=form)
예제 #12
0
def register():
    """Register new user."""
    form = RegisterForm(request.form)
    if form.validate_on_submit():
        user = User.create(username=form.username.data,
                           email=form.email.data,
                           password=form.password.data,
                           active=False)
        flash(
            'Thank you for registering. Please validate your email '
            'address before logging in.', 'success')
        send_confirm_email(user)
        return redirect(url_for('public.home'))
    else:
        flash_errors(form)
    return render_template('register.html', form=form)
예제 #13
0
def register():
    """Register new user."""
    form = RegisterForm(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        user = User.create(username=form.username.data, email=form.email.data, password=form.password.data,
                    first_name=form.firstname.data, last_name=form.lastname.data, active=True, confirmed=False)
        email = form.email.data
        token = generate_confirmation_token(email)
        confirm_url = url_for('public.confirm_email', token=token, _external=True)
        html = render_template('public/email_templates/confirm.html', confirm_url=confirm_url)
        subject = "Please confirm your email"
        send_mailgun_email(email, subject, html)

        login_user(user)

        flash('Thank you for registering, a confirmation email has been sent', 'success')
        return redirect(url_for('public.unconfirmed'))

    else:
        flash_errors(form)
    return render_template('public/register.html', form=form)
예제 #14
0
 def test_validate_success(self, db):
     form = RegisterForm(username='******', email='*****@*****.**',
         password='******', confirm='example')
     assert form.validate() is True