mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 15:53:22 +08:00
Implement "Send me an email" button on final extension onboarding
This commit is contained in:
parent
3872626747
commit
933237e73b
2 changed files with 33 additions and 3 deletions
|
@ -1,9 +1,26 @@
|
|||
from app.extensions import limiter
|
||||
from app.onboarding.base import onboarding_bp
|
||||
from flask import render_template
|
||||
from app.email_utils import send_test_email_alias
|
||||
from flask import render_template, request, flash
|
||||
from flask_login import current_user, login_required
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, validators
|
||||
|
||||
|
||||
@onboarding_bp.route("/final", methods=["GET"])
|
||||
class SendEmailForm(FlaskForm):
|
||||
email = StringField("Email", validators=[validators.DataRequired()])
|
||||
|
||||
|
||||
@onboarding_bp.route("/final", methods=["GET", "POST"])
|
||||
@login_required
|
||||
@limiter.limit("10/minute")
|
||||
def final():
|
||||
form = SendEmailForm(request.form)
|
||||
if form.validate_on_submit():
|
||||
send_test_email_alias(form.email.data, current_user.name)
|
||||
flash("We have sent a test e-mail to your alias", "success")
|
||||
|
||||
return render_template(
|
||||
"onboarding/final.html",
|
||||
form=form,
|
||||
)
|
||||
|
|
|
@ -15,7 +15,20 @@
|
|||
|
||||
<!-- Text container -->
|
||||
<div class="mt-8 mb-4 text-center">
|
||||
<h2 class="text-red" style="font-size:2rem">All set!</h2>
|
||||
<h2 class="text-black-50" style="font-size:2rem">Quickly create an alias every time you need an email</h2>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Input + button container -->
|
||||
<div class="mt-8" style="display: grid; place-items: center;">
|
||||
<div style="width: 25rem; display: block">
|
||||
<form method="post">
|
||||
{{ form.csrf_token }}
|
||||
{{ form.email(class="p-3", type="email", autofocus="true", placeholder="email", style="border: 2px solid black; border-radius: 2px; width:100%") }}
|
||||
{{ render_field_errors(form.email) }}
|
||||
<button type="submit" class="p-4 mt-2 text-decoration-none" style="background:black;color:white; width:10rem">Send me an email</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue