remove become partner view

This commit is contained in:
Son NK 2019-11-15 13:54:25 +01:00
parent 53df01e54b
commit a084ea880d
7 changed files with 1 additions and 103 deletions

View File

@ -1 +0,0 @@
from .views import become

View File

@ -1,8 +0,0 @@
from flask import Blueprint
partner_bp = Blueprint(
name="partner",
import_name=__name__,
url_prefix="/partner",
template_folder="templates",
)

View File

@ -1,41 +0,0 @@
{% extends "single.html" %}
{% block title %}
Become Partner
{% endblock %}
{% block single_content %}
{% if error %}
<div class="text-danger text-center mb-4">{{ error }}</div>
{% endif %}
<form class="card" method="post">
{{ form.csrf_token }}
<div class="card-body p-6">
<div class="card-title">Together, let's create the best login experience for users!</div>
<p class="text-muted">Becoming a partner will give you access to technical resources on SimpleLogin.</p>
<div class="form-group">
<label class="form-label">Your Email</label>
{{ form.email(class="form-control", type="email", placeholder="partner@my-app.com", value=current_user.email) }}
{{ render_field_errors(form.email) }}
</div>
<div class="form-group">
<label class="form-label">Your Business Name</label>
{{ form.name(class="form-control", placeholder="My App Inc", value=current_user.name) }}
{{ render_field_errors(form.name) }}
</div>
<div class="form-group">
<label class="form-label">Your Website/App URL</label>
{{ form.website(class="form-control", type="url", placeholder="https://my-app.com") }}
{{ render_field_errors(form.website) }}
</div>
<div class="form-footer">
<button type="submit" class="btn btn-primary btn-block">Become a Partner</button>
</div>
</div>
</form>
{% endblock %}

View File

@ -1,47 +0,0 @@
from flask import request, render_template, redirect, url_for, flash
from flask_login import current_user
from flask_wtf import FlaskForm
from wtforms import StringField
from app.email_utils import notify_admin
from app.extensions import db
from app.models import Partner
from app.partner.base import partner_bp
class BecomePartnerForm(FlaskForm):
email = StringField("Email")
name = StringField("Name")
website = StringField("Website")
additional_information = StringField("Additional Information")
@partner_bp.route("/become", methods=["GET", "POST"])
def become():
form = BecomePartnerForm(request.form)
if form.validate_on_submit():
partner = Partner.create(
email=form.email.data,
name=form.name.data,
website=form.website.data,
additional_information=form.additional_information.data,
)
if current_user.is_authenticated:
partner.user_id = current_user.id
db.session.commit()
notify_admin(
f"New partner {partner.name} {partner.email} has signed up!",
partner.website,
)
flash(
"Your request has been submitted, we'll come back to you asap!", "success"
)
return redirect(url_for("partner.become"))
return render_template("partner/become.html", form=form)

View File

@ -42,7 +42,6 @@ from app.models import (
)
from app.monitor.base import monitor_bp
from app.oauth.base import oauth_bp
from app.partner.base import partner_bp
if ENABLE_SENTRY:
LOG.d("enable sentry")
@ -150,7 +149,6 @@ def register_blueprints(app: Flask):
app.register_blueprint(monitor_bp)
app.register_blueprint(dashboard_bp)
app.register_blueprint(developer_bp)
app.register_blueprint(partner_bp)
app.register_blueprint(oauth_bp, url_prefix="/oauth")
app.register_blueprint(oauth_bp, url_prefix="/oauth2")

View File

@ -11,6 +11,7 @@
<a href="{{ url_for('dashboard.pricing') }}" class="btn btn-sm btn-outline-primary">Upgrade To Premium</a>
</div>
{% endif %}
<div class="dropdown d-none d-md-flex">
<a class="nav-link icon"
data-intro="Welcome to SimpleLogin! <br><br>
@ -40,10 +41,6 @@
<i class="dropdown-icon fe fe-settings"></i> Settings
</a>
{# <a class="dropdown-item" href="{{ url_for('partner.become') }}">#}
{# <i class="dropdown-icon fe fe-target"></i> Become Partner/Developer#}
{# </a>#}
{% if current_user.is_premium() %}
<a class="dropdown-item" href="{{ url_for('dashboard.billing') }}">
<i class="dropdown-icon fe fe-dollar-sign"></i> Billing