Browse Source

Open PGP to everyone

Son NK 5 years ago
parent
commit
ea43b8f685

+ 1 - 1
.pre-commit-config.yaml

@@ -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

+ 0 - 4
app/dashboard/templates/dashboard/mailbox_detail.html

@@ -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 %}

+ 0 - 6
app/dashboard/views/mailbox_detail.py

@@ -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:

+ 0 - 5
app/models.py

@@ -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 - 0
migrations/versions/2020_031621_91b69dfad2f1_.py

@@ -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 ###

+ 0 - 1
server.py

@@ -131,7 +131,6 @@ def fake_data():
         activated=True,
         activated=True,
         is_admin=True,
         is_admin=True,
         otp_secret="base32secret3232",
         otp_secret="base32secret3232",
-        can_use_pgp=True,
     )
     )
     db.session.commit()
     db.session.commit()