def signup():
    """if not conf.SELF_REGISTRATION:
        flash("Self-registration is disabled.", 'warning')
        return redirect(url_for('index'))"""
    if current_user.is_authenticated:
        return redirect(url_for('index'))

    form = SignupForm()
    if form.validate_on_submit():
        user = User(name=form.name.data,
                    email=form.email.data,
                    pwdhash=generate_password_hash(form.password.data),
                    is_active=True)
        db.session.add(user)
        db.session.commit()
        flash('Your account has been created. ', 'success')
        login_user_bundle(user)  # automatically log the user

        return form.redirect('index')

    loginForm = LoginForm()
    return render_template('join.html', loginForm=loginForm, signupForm=form)