mirror of
https://github.com/simple-login/app.git
synced 2025-02-25 00:03:03 +08:00
rename public_domain -> sl_domain if applicable
This commit is contained in:
parent
4a32db5b5d
commit
dbf0404aa9
2 changed files with 14 additions and 14 deletions
|
@ -200,15 +200,15 @@ def setting():
|
||||||
default_domain = request.form.get("random-alias-default-domain")
|
default_domain = request.form.get("random-alias-default-domain")
|
||||||
|
|
||||||
if default_domain:
|
if default_domain:
|
||||||
public_domain: SLDomain = SLDomain.get_by(domain=default_domain)
|
sl_domain: SLDomain = SLDomain.get_by(domain=default_domain)
|
||||||
if public_domain:
|
if sl_domain:
|
||||||
if public_domain.premium_only and not current_user.is_premium():
|
if sl_domain.premium_only and not current_user.is_premium():
|
||||||
flash("You cannot use this domain", "error")
|
flash("You cannot use this domain", "error")
|
||||||
return redirect(url_for("dashboard.setting"))
|
return redirect(url_for("dashboard.setting"))
|
||||||
|
|
||||||
# make sure only default_random_alias_domain_id or default_random_alias_public_domain_id is set
|
# make sure only default_random_alias_domain_id or default_random_alias_public_domain_id is set
|
||||||
current_user.default_random_alias_public_domain_id = (
|
current_user.default_random_alias_public_domain_id = (
|
||||||
public_domain.id
|
sl_domain.id
|
||||||
)
|
)
|
||||||
current_user.default_random_alias_domain_id = None
|
current_user.default_random_alias_domain_id = None
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -516,19 +516,19 @@ class User(db.Model, ModelMixin, UserMixin):
|
||||||
return custom_domain.domain
|
return custom_domain.domain
|
||||||
|
|
||||||
if self.default_random_alias_public_domain_id:
|
if self.default_random_alias_public_domain_id:
|
||||||
public_domain = SLDomain.get(self.default_random_alias_public_domain_id)
|
sl_domain = SLDomain.get(self.default_random_alias_public_domain_id)
|
||||||
# sanity check
|
# sanity check
|
||||||
if not public_domain:
|
if not sl_domain:
|
||||||
LOG.exception("Problem with %s public random alias domain", self)
|
LOG.exception("Problem with %s public random alias domain", self)
|
||||||
return FIRST_ALIAS_DOMAIN
|
return FIRST_ALIAS_DOMAIN
|
||||||
|
|
||||||
if public_domain.premium_only and not self.is_premium():
|
if sl_domain.premium_only and not self.is_premium():
|
||||||
LOG.exception(
|
LOG.exception(
|
||||||
"%s is not premium and cannot use %s", self, public_domain
|
"%s is not premium and cannot use %s", self, sl_domain
|
||||||
)
|
)
|
||||||
return FIRST_ALIAS_DOMAIN
|
return FIRST_ALIAS_DOMAIN
|
||||||
|
|
||||||
return public_domain.domain
|
return sl_domain.domain
|
||||||
|
|
||||||
return FIRST_ALIAS_DOMAIN
|
return FIRST_ALIAS_DOMAIN
|
||||||
|
|
||||||
|
@ -567,7 +567,7 @@ class User(db.Model, ModelMixin, UserMixin):
|
||||||
else:
|
else:
|
||||||
query = SLDomain.filter_by(premium_only=False)
|
query = SLDomain.filter_by(premium_only=False)
|
||||||
|
|
||||||
domains = [public_domain.domain for public_domain in query]
|
domains = [sl_domain.domain for sl_domain in query]
|
||||||
|
|
||||||
return domains
|
return domains
|
||||||
|
|
||||||
|
@ -989,14 +989,14 @@ class Alias(db.Model, ModelMixin):
|
||||||
scheme=scheme, in_hex=in_hex, alias_domain=custom_domain.domain
|
scheme=scheme, in_hex=in_hex, alias_domain=custom_domain.domain
|
||||||
)
|
)
|
||||||
elif user.default_random_alias_public_domain_id:
|
elif user.default_random_alias_public_domain_id:
|
||||||
public_domain: SLDomain = SLDomain.get(
|
sl_domain: SLDomain = SLDomain.get(
|
||||||
user.default_random_alias_public_domain_id
|
user.default_random_alias_public_domain_id
|
||||||
)
|
)
|
||||||
if public_domain.premium_only and not user.is_premium():
|
if sl_domain.premium_only and not user.is_premium():
|
||||||
LOG.exception("%s not premium, cannot use %s", user, public_domain)
|
LOG.exception("%s not premium, cannot use %s", user, sl_domain)
|
||||||
else:
|
else:
|
||||||
random_email = generate_email(
|
random_email = generate_email(
|
||||||
scheme=scheme, in_hex=in_hex, alias_domain=public_domain.domain
|
scheme=scheme, in_hex=in_hex, alias_domain=sl_domain.domain
|
||||||
)
|
)
|
||||||
|
|
||||||
if not random_email:
|
if not random_email:
|
||||||
|
|
Loading…
Reference in a new issue