remove User.can_use_subdomain column, make subdomain available to all users
This commit is contained in:
parent
82e0bcec8e
commit
eaff8b7ff3
|
@ -10,7 +10,7 @@ from app.models import CustomDomain, Mailbox, SLDomain
|
||||||
@dashboard_bp.route("/subdomain", methods=["GET", "POST"])
|
@dashboard_bp.route("/subdomain", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def subdomain_route():
|
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")
|
flash("Unknown error, redirect to the home page", "error")
|
||||||
return redirect(url_for("dashboard.index"))
|
return redirect(url_for("dashboard.index"))
|
||||||
|
|
||||||
|
|
|
@ -387,11 +387,6 @@ class User(Base, ModelMixin, UserMixin, PasswordOracle):
|
||||||
sa.Boolean, default=False, nullable=False, server_default="0"
|
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
|
# 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(
|
include_website_in_one_click_alias = sa.Column(
|
||||||
sa.Boolean,
|
sa.Boolean,
|
||||||
|
|
29
migrations/versions/2021_111511_11ba83e2dd71_.py
Normal file
29
migrations/versions/2021_111511_11ba83e2dd71_.py
Normal 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 ###
|
|
@ -28,7 +28,7 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{% if current_user.can_use_subdomain and current_user.subdomain_is_available() %}
|
{% if current_user.subdomain_is_available() %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{ url_for('dashboard.subdomain_route') }}"
|
<a href="{{ url_for('dashboard.subdomain_route') }}"
|
||||||
class="nav-link {{ 'active' if active_page == 'subdomain' }}">
|
class="nav-link {{ 'active' if active_page == 'subdomain' }}">
|
||||||
|
|
Loading…
Reference in a new issue