remove User.can_use_subdomain column, make subdomain available to all users

This commit is contained in:
Son 2021-11-15 11:16:03 +01:00
parent 82e0bcec8e
commit eaff8b7ff3
4 changed files with 31 additions and 7 deletions

View File

@ -10,7 +10,7 @@ from app.models import CustomDomain, Mailbox, SLDomain
@dashboard_bp.route("/subdomain", methods=["GET", "POST"])
@login_required
def subdomain_route():
if not current_user.can_use_subdomain or not current_user.subdomain_is_available():
if not current_user.subdomain_is_available():
flash("Unknown error, redirect to the home page", "error")
return redirect(url_for("dashboard.index"))

View File

@ -387,11 +387,6 @@ class User(Base, ModelMixin, UserMixin, PasswordOracle):
sa.Boolean, default=False, nullable=False, server_default="0"
)
# subdomain access is limited at the beginning
can_use_subdomain = sa.Column(
sa.Boolean, default=False, nullable=False, server_default="0"
)
# automatically include the website name when user creates an alias via the SimpleLogin icon in the email field
include_website_in_one_click_alias = sa.Column(
sa.Boolean,

View File

@ -0,0 +1,29 @@
"""empty message
Revision ID: 11ba83e2dd71
Revises: 5639ad89ee50
Create Date: 2021-11-15 11:15:14.060491
"""
import sqlalchemy_utils
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '11ba83e2dd71'
down_revision = '5639ad89ee50'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'can_use_subdomain')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('can_use_subdomain', sa.BOOLEAN(), server_default=sa.text('false'), autoincrement=False, nullable=False))
# ### end Alembic commands ###

View File

@ -28,7 +28,7 @@
</a>
</li>
{% if current_user.can_use_subdomain and current_user.subdomain_is_available() %}
{% if current_user.subdomain_is_available() %}
<li class="nav-item">
<a href="{{ url_for('dashboard.subdomain_route') }}"
class="nav-link {{ 'active' if active_page == 'subdomain' }}">