Merge pull request #85 from simple-login/deleted-alias-page

Deleted alias page
This commit is contained in:
Son Nguyen Kim 2020-02-15 21:55:15 +07:00 committed by GitHub
commit 9d2aff6aa8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 171 additions and 114 deletions

View file

@ -15,4 +15,5 @@ from .views import (
lifetime_licence,
directory,
mailbox,
deleted_alias,
)

View file

@ -3,8 +3,8 @@
{% set active_page = "dashboard" %}
{% block head %}
<style>
{# https://bootsnipp.com/snippets/rljEW#}
.card-counter{
{# https://bootsnipp.com/snippets/rljEW#}
.card-counter {
box-shadow: 2px 2px 10px #DADADA;
margin: 5px;
padding: 20px 10px;
@ -14,37 +14,37 @@
transition: .3s linear all;
}
.card-counter:hover{
.card-counter:hover {
box-shadow: 4px 4px 20px #DADADA;
transition: .3s linear all;
}
.card-counter.primary{
.card-counter.primary {
background-color: #007bff;
color: #FFF;
}
.card-counter.danger{
.card-counter.danger {
background-color: #ef5350;
color: #FFF;
}
.card-counter.success{
.card-counter.success {
background-color: #66bb6a;
color: #FFF;
}
.card-counter.info{
.card-counter.info {
background-color: #26c6da;
color: #FFF;
}
.card-counter i{
.card-counter i {
font-size: 5em;
opacity: 0.2;
}
.card-counter .count-numbers{
.card-counter .count-numbers {
position: absolute;
right: 35px;
top: 20px;
@ -52,7 +52,7 @@
display: block;
}
.card-counter .count-name{
.card-counter .count-name {
position: absolute;
right: 35px;
top: 65px;
@ -134,7 +134,8 @@
<nav aria-label="Alias log navigation">
<ul class="pagination">
<li class="page-item {% if page_id == 0 %}disabled{% endif %}">
<a class="page-link" href="{{ url_for('dashboard.alias_log', alias_id=alias_id, page_id=page_id-1) }}">Previous</a>
<a class="page-link"
href="{{ url_for('dashboard.alias_log', alias_id=alias_id, page_id=page_id-1) }}">Previous</a>
</li>
<li class="page-item {% if last_page %}disabled{% endif %}">
<a class="page-link" href="{{ url_for('dashboard.alias_log', alias_id=alias_id, page_id=page_id+1) }}">Next</a>

View file

@ -8,12 +8,12 @@
{% endblock %}
{% block default_content %}
<div class="row">
<div class="col-md-8 offset-md-2">
<h1> Billing </h1>
<div class="bg-white p-6" style="max-width: 60em; margin: auto">
<h1 class="h3 mb-5"> Billing </h1>
<p>
You are on the <b>{{ current_user.get_subscription().plan_name() }}</b> plan. Thank you very much for supporting SimpleLogin. 🙌
You are on the <b>{{ current_user.get_subscription().plan_name() }}</b> plan. Thank you very much for supporting
SimpleLogin. 🙌
</p>
{% if sub.cancelled %}
@ -34,9 +34,6 @@
<a class="btn btn-warning" href="{{ sub.cancel_url }}"> Cancel subscription 😔 </a>
</div>
{% endif %}
</div>
</div>

View file

@ -0,0 +1,25 @@
{% extends 'default.html' %}
{% block title %}
Deleted Aliases
{% endblock %}
{% block head %}
{% endblock %}
{% block default_content %}
<div style="max-width: 60em; margin: auto">
<h1 class="h3 mb-5"> Deleted Aliases </h1>
{% for deleted_alias in deleted_aliases %}
<div class="my-4 p-4 card border-light">
{{ deleted_alias.email }}
<div class="small-text">
Deleted {{ deleted_alias.created_at | dt }}
</div>
</div>
{% endfor %}
</div>
{% endblock %}

View file

@ -126,26 +126,25 @@
<div class="card">
<div class="card-body">
<div class="card-title" id="notification">Notifications
<div class="small-text mt-1 mb-3">Do you want to receive our newsletters?</div>
<div class="card-title" id="notification">Newsletters
<div class="small-text mt-1 mb-3">
Every now and then we can send you an email
to let you know about a new feature that might be useful to you.
</div>
</div>
<form method="post">
<input type="hidden" name="form-name" value="notification-preference">
<div class="form-inline mb-3">
<div class="form-group">
<div class="form-check">
<input type="checkbox" id="notification" name="notification" {% if current_user.notification %}
checked {% endif %} class="form-check-input">
<label for="notification">I want to receive your newsletter</label>
</div>
</div>
<button type="submit" class="btn btn-outline-primary">Submit</button>
</form>
</div>
</div>
{% if current_user.get_subscription() %}
<div class="card">
<div class="card-body">
@ -161,6 +160,22 @@
</div>
{% endif %}
<div class="card">
<div class="card-body">
<div class="card-title">Deleted Aliases
<div class="small-text mt-1 mb-3" style="max-width: 40rem">
When an alias is deleted, all its activities are deleted and no emails can be sent to it. <br>
It is moved to another location and only used to check when new alias is created. <br>
This check is necessary to avoid someone else accidentally taking this alias. <br>
Because in this case, the other person might receive inadvertently information that belong to you. <br>
</div>
</div>
<a href="{{ url_for('dashboard.deleted_alias_route') }}" class="btn btn-outline-primary">
See deleted aliases
</a>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="card-title">Export Data

View file

@ -0,0 +1,13 @@
from flask import render_template
from flask_login import login_required, current_user
from app.dashboard.base import dashboard_bp
from app.models import DeletedAlias
@dashboard_bp.route("/deleted_alias", methods=["GET", "POST"])
@login_required
def deleted_alias_route():
deleted_aliases = DeletedAlias.query.filter_by(user_id=current_user.id)
return render_template("dashboard/deleted_alias.html", **locals())

View file

@ -49,6 +49,7 @@ from app.models import (
LifetimeCoupon,
Directory,
Mailbox,
DeletedAlias,
)
from app.monitor.base import monitor_bp
from app.oauth.base import oauth_bp
@ -184,6 +185,10 @@ def fake_data():
Mailbox.create(user_id=user.id, email="ab@cd.ef", verified=True)
db.session.commit()
DeletedAlias.create(user_id=user.id, email="d1@ab.cd")
DeletedAlias.create(user_id=user.id, email="d2@ab.cd")
db.session.commit()
@login_manager.user_loader
def load_user(user_id):