~fnux/meta.sr.ht

c853a830a267975773aaf36ec0eb685aceaf4522 — Drew DeVault 8 months ago 981f61a 0.50.1
Improve UX for unconfirmed & suspended users
2 files changed, 13 insertions(+), 1 deletions(-)

M metasrht/blueprints/auth.py
M metasrht/templates/user.html
M metasrht/blueprints/auth.py => metasrht/blueprints/auth.py +7 -1
@@ 253,7 253,7 @@ def login_POST():
    return_to = valid.optional("return_to", "/")

    if not valid.ok:
        return render_template("login.html", valid=valid), 400
        return render_template("login.html", **valid.kwargs), 400

    user_valid(valid, username, password)



@@ 265,6 265,12 @@ def login_POST():
            valid=valid)

    user = prepare_user(username)
    valid.expect(user.user_type != UserType.unconfirmed,
            "Your account is unconfirmed. Please check your inbox, or reach out to support if you did not receive an email.")
    valid.expect(user.user_type != UserType.suspended,
            f"Your account is suspended: {user.suspension_notice}. Contact support.")
    if not valid.ok:
        return render_template("login.html", **valid.kwargs), 400

    factors = (UserAuthFactor.query
        .filter(UserAuthFactor.user_id == user.id)).all()

M metasrht/templates/user.html => metasrht/templates/user.html +6 -0
@@ 7,6 7,8 @@
<div class="row">
  <section class="col-md-12">
    <dl class="row">
      <dt class="col-md-3">User ID</dt>
      <dd class="col-md-9">{{user.id}}</dd>
      <dt class="col-md-3">Email</dt>
      <dd class="col-md-9">
        <a href="mailto:{{user.email}}">{{user.email}}</a>


@@ 15,6 17,10 @@
      <dd class="col-md-9">{{user.created | date}}</dd>
      <dt class="col-md-3">User type</dt>
      <dd class="col-md-9">{{user.user_type.value}}</dd>
      {% if user.user_type.value == "suspended" %}
      <dt class="col-md-3">Suspension Notice</dt>
      <dd class="col-md-9">{{user.suspension_notice}}</dd>
      {% endif %}
      <dt class="col-md-3">Welcome emails</dt>
      <dd class="col-md-9">{{user.welcome_emails}}</dd>
      {% if cfg("meta.sr.ht::billing", "enabled") == "yes"