mirror of
https://github.com/simple-login/app.git
synced 2024-09-20 15:05:59 +08:00
fix domain can be null in self-hosting
# Conflicts: # app/api/views/new_custom_alias.py # app/dashboard/views/custom_alias.py
This commit is contained in:
parent
4906d3a4a8
commit
1a22d0cf9b
|
@ -85,8 +85,9 @@ def new_custom_alias():
|
|||
if alias_suffix.startswith("@"):
|
||||
alias_domain = alias_suffix[1:]
|
||||
domain = CustomDomain.get_by(domain=alias_domain)
|
||||
LOG.d("set alias %s to domain %s", full_alias, domain)
|
||||
alias.custom_domain_id = domain.id
|
||||
if domain:
|
||||
LOG.d("set alias %s to domain %s", full_alias, domain)
|
||||
alias.custom_domain_id = domain.id
|
||||
|
||||
db.session.commit()
|
||||
|
||||
|
|
|
@ -130,7 +130,8 @@ def custom_alias():
|
|||
)
|
||||
return redirect(url_for("dashboard.custom_alias"))
|
||||
|
||||
custom_domain_id = domain.id
|
||||
if domain:
|
||||
custom_domain_id = domain.id
|
||||
|
||||
alias = Alias.create(
|
||||
user_id=current_user.id,
|
||||
|
|
|
@ -192,7 +192,8 @@ def authorize():
|
|||
if alias_suffix.startswith("@"):
|
||||
alias_domain = alias_suffix[1:]
|
||||
domain = CustomDomain.get_by(domain=alias_domain)
|
||||
alias.custom_domain_id = domain.id
|
||||
if domain:
|
||||
alias.custom_domain_id = domain.id
|
||||
|
||||
db.session.flush()
|
||||
flash(f"Alias {full_alias} has been created", "success")
|
||||
|
|
Loading…
Reference in a new issue