Merge pull request #114 from simple-login/pgp-for-everyone
Open PGP to everyone
This commit is contained in:
commit
269bca8ff3
|
@ -1,5 +1,5 @@
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/ambv/black
|
- repo: https://github.com/psf/black
|
||||||
rev: stable
|
rev: stable
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
|
|
|
@ -64,8 +64,6 @@
|
||||||
<!-- END Change email -->
|
<!-- END Change email -->
|
||||||
|
|
||||||
|
|
||||||
<!-- Change PGP Public key -->
|
|
||||||
{% if current_user.can_use_pgp %}
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" name="form-name" value="pgp">
|
<input type="hidden" name="form-name" value="pgp">
|
||||||
|
@ -91,8 +89,6 @@
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
<!-- END PGP Public key -->
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -100,12 +100,6 @@ def mailbox_detail_route(mailbox_id):
|
||||||
url_for("dashboard.mailbox_detail_route", mailbox_id=mailbox_id)
|
url_for("dashboard.mailbox_detail_route", mailbox_id=mailbox_id)
|
||||||
)
|
)
|
||||||
elif request.form.get("form-name") == "pgp":
|
elif request.form.get("form-name") == "pgp":
|
||||||
if not current_user.can_use_pgp:
|
|
||||||
flash("You cannot use PGP", "error")
|
|
||||||
return redirect(
|
|
||||||
url_for("dashboard.mailbox_detail_route", mailbox_id=mailbox_id)
|
|
||||||
)
|
|
||||||
|
|
||||||
if request.form.get("action") == "save":
|
if request.form.get("action") == "save":
|
||||||
mailbox.pgp_public_key = request.form.get("pgp")
|
mailbox.pgp_public_key = request.form.get("pgp")
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -143,11 +143,6 @@ class User(db.Model, ModelMixin, UserMixin):
|
||||||
db.ForeignKey("mailbox.id"), nullable=True, default=None
|
db.ForeignKey("mailbox.id"), nullable=True, default=None
|
||||||
)
|
)
|
||||||
|
|
||||||
# feature flag
|
|
||||||
can_use_pgp = db.Column(
|
|
||||||
db.Boolean, default=False, nullable=False, server_default="0"
|
|
||||||
)
|
|
||||||
|
|
||||||
profile_picture = db.relationship(File)
|
profile_picture = db.relationship(File)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
38
migrations/versions/2020_031621_91b69dfad2f1_.py
Normal file
38
migrations/versions/2020_031621_91b69dfad2f1_.py
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 91b69dfad2f1
|
||||||
|
Revises: 9081f1a90939
|
||||||
|
Create Date: 2020-03-16 21:15:48.652860
|
||||||
|
|
||||||
|
"""
|
||||||
|
import sqlalchemy_utils
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = "91b69dfad2f1"
|
||||||
|
down_revision = "9081f1a90939"
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column("users", "can_use_pgp")
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column(
|
||||||
|
"users",
|
||||||
|
sa.Column(
|
||||||
|
"can_use_pgp",
|
||||||
|
sa.BOOLEAN(),
|
||||||
|
server_default=sa.text("false"),
|
||||||
|
autoincrement=False,
|
||||||
|
nullable=False,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in a new issue