fix error when user logs out, go back to /dashboard and has the server error (#2003)
* fix error when user logs out, go back to /dashboard and has the server error * reformat files. Not run ruff on migrations/ and .venv --------- Co-authored-by: Son NK <son@simplelogin.io>
This commit is contained in:
parent
a731bf4435
commit
4a046c5f6f
|
@ -52,13 +52,13 @@ def get_stats(user: User) -> Stats:
|
|||
|
||||
|
||||
@dashboard_bp.route("/", methods=["GET", "POST"])
|
||||
@login_required
|
||||
@limiter.limit(
|
||||
ALIAS_LIMIT,
|
||||
methods=["POST"],
|
||||
exempt_when=lambda: request.form.get("form-name") != "create-random-email",
|
||||
)
|
||||
@limiter.limit("10/minute", methods=["GET"], key_func=lambda: current_user.id)
|
||||
@login_required
|
||||
@parallel_limiter.lock(
|
||||
name="alias_creation",
|
||||
only_when=lambda: request.form.get("form-name") == "create-random-email",
|
||||
|
|
|
@ -20,6 +20,7 @@ exclude = '''
|
|||
|
||||
[tool.ruff]
|
||||
ignore-init-module-imports = true
|
||||
exclude = [".venv", "migrations"]
|
||||
|
||||
[tool.djlint]
|
||||
indent = 2
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
You are about to deactivate the alias
|
||||
<a href="mailto:{{ alias }}" target="_blank">{{ alias }}</a>
|
||||
</p>
|
||||
<p>After this, you will stop receiving all emails sent to this alias, please confirm. You will always be able to re-activate it untill you will decide to delete it.</p>
|
||||
<p>
|
||||
After this, you will stop receiving all emails sent to this alias, please confirm. You will always be able to re-activate it untill you will decide to delete it.
|
||||
</p>
|
||||
<form method="post">
|
||||
<button class="btn btn-warning">Confirm</button>
|
||||
</form>
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
alt="GitHub">
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="list-group-item text-white footer-item "
|
||||
href="https://status.simplelogin.io/">Status</a>
|
||||
|
@ -55,12 +54,10 @@
|
|||
<a class="list-group-item text-white footer-item"
|
||||
href="https://simplelogin.io/blog/">Blog</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="list-group-item text-white footer-item"
|
||||
href="https://simplelogin.io/about/">About Us</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="list-group-item text-white footer-item"
|
||||
href="https://simplelogin.io/contact/">Contact Us</a>
|
||||
|
@ -100,7 +97,6 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-4 col-lg-2 mb-4">
|
||||
<h3 class="h4 text-white">Downloads</h3>
|
||||
<ul class="list-group list-group-transparent list-group-white list-group-flush list-group-borderless mb-0 footer-list-group">
|
||||
|
|
|
@ -89,86 +89,86 @@
|
|||
Github repo
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i>
|
||||
</a>
|
||||
<div class="dropdown-item">
|
||||
<a href="https://forum.simplelogin.io"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Forum
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="dropdown-item">
|
||||
<a href="/dashboard/support">Support</a>
|
||||
<div class="dropdown-item">
|
||||
<a href="https://forum.simplelogin.io"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Forum
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="dropdown-item">
|
||||
<a href="/dashboard/support">Support</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="nav-item">
|
||||
<a href="https://simplelogin.io/docs/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Docs
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if current_user.should_show_upgrade_button() %}
|
||||
{% else %}
|
||||
<div class="nav-item">
|
||||
<a href="https://simplelogin.io/docs/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
Docs
|
||||
<i class="fa fa-external-link" aria-hidden="true"></i>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if current_user.should_show_upgrade_button() %}
|
||||
|
||||
<div class="nav-item">
|
||||
<a href="{{ url_for('dashboard.pricing') }}"
|
||||
class="btn btn-sm btn-outline-primary">Upgrade</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="dropdown">
|
||||
<a href="#" class="nav-link pr-0 leading-none" data-toggle="dropdown">
|
||||
{% if current_user.profile_picture_id %}
|
||||
<div class="nav-item">
|
||||
<a href="{{ url_for('dashboard.pricing') }}"
|
||||
class="btn btn-sm btn-outline-primary">Upgrade</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="dropdown">
|
||||
<a href="#" class="nav-link pr-0 leading-none" data-toggle="dropdown">
|
||||
{% if current_user.profile_picture_id %}
|
||||
|
||||
<span class="avatar"
|
||||
style="background-image: url('{{ current_user.profile_picture_url() }}')"></span>
|
||||
{% else %}
|
||||
<span class="avatar avatar-blue">{{ current_user.get_name_initial() or "👻" }}</span>
|
||||
{% endif %}
|
||||
<span class="ml-2 d-none d-lg-block">
|
||||
<span class="text-default text-break">{{ current_user.name or current_user.email }}</span>
|
||||
{% if current_user.in_trial() %}
|
||||
|
||||
<small class="text-success d-block mt-1"
|
||||
data-toggle="tooltip"
|
||||
title="When you signed up, you have a free 7-day Premium trial. After that your account will automatically be downgraded to the Free plan. During the trial, the only limit is you can't create more than {{ MAX_NB_EMAIL_FREE_PLAN }} aliases.">
|
||||
Premium expires {{ current_user.trial_end|dt }}
|
||||
<i class="fe fe-info"></i>
|
||||
</small>
|
||||
{% elif current_user.is_premium() %}
|
||||
<small class="text-success d-block mt-1">Premium</small>
|
||||
<span class="avatar"
|
||||
style="background-image: url('{{ current_user.profile_picture_url() }}')"></span>
|
||||
{% else %}
|
||||
<span class="avatar avatar-blue">{{ current_user.get_name_initial() or "👻" }}</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
|
||||
<a class="dropdown-item mb-3" href="{{ url_for('dashboard.api_key') }}">
|
||||
<i class="dropdown-icon fa fa-key"></i> API Keys
|
||||
</a>
|
||||
<a class="dropdown-item" href="{{ url_for('auth.logout') }}">
|
||||
<i class="dropdown-icon fe fe-log-out"></i> Sign out
|
||||
<span class="ml-2 d-none d-lg-block">
|
||||
<span class="text-default text-break">{{ current_user.name or current_user.email }}</span>
|
||||
{% if current_user.in_trial() %}
|
||||
|
||||
<small class="text-success d-block mt-1"
|
||||
data-toggle="tooltip"
|
||||
title="When you signed up, you have a free 7-day Premium trial. After that your account will automatically be downgraded to the Free plan. During the trial, the only limit is you can't create more than {{ MAX_NB_EMAIL_FREE_PLAN }} aliases.">
|
||||
Premium expires {{ current_user.trial_end|dt }}
|
||||
<i class="fe fe-info"></i>
|
||||
</small>
|
||||
{% elif current_user.is_premium() %}
|
||||
<small class="text-success d-block mt-1">Premium</small>
|
||||
{% endif %}
|
||||
</span>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
|
||||
<a class="dropdown-item mb-3" href="{{ url_for('dashboard.api_key') }}">
|
||||
<i class="dropdown-icon fa fa-key"></i> API Keys
|
||||
</a>
|
||||
<a class="dropdown-item" href="{{ url_for('auth.logout') }}">
|
||||
<i class="dropdown-icon fe fe-log-out"></i> Sign out
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="#"
|
||||
class="header-toggler d-lg-none ml-3 ml-lg-0"
|
||||
data-toggle="collapse"
|
||||
data-target="#headerMenuCollapse">
|
||||
<span class="header-toggler-icon"></span>
|
||||
</a>
|
||||
</div>
|
||||
<a href="#"
|
||||
class="header-toggler d-lg-none ml-3 ml-lg-0"
|
||||
data-toggle="collapse"
|
||||
data-target="#headerMenuCollapse">
|
||||
<span class="header-toggler-icon"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header collapse d-lg-flex p-0" id="headerMenuCollapse">
|
||||
<div class="container">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-lg order-lg-first">
|
||||
{% include "menu.html" %}
|
||||
<div class="header collapse d-lg-flex p-0" id="headerMenuCollapse">
|
||||
<div class="container">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-lg order-lg-first">
|
||||
{% include "menu.html" %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue