auth selection: cookie with optional domain parameter
This commit is contained in:
parent
a548575704
commit
bf954a9614
2 changed files with 6 additions and 1 deletions
|
|
@ -49,6 +49,10 @@ class LoginPageSelect(LoginPage):
|
||||||
def showSelection(self):
|
def showSelection(self):
|
||||||
return getConfigAuthMethod() == 'cookie'
|
return getConfigAuthMethod() == 'cookie'
|
||||||
|
|
||||||
|
def authMethodCookieString(self):
|
||||||
|
domain = getattr(config, 'authentication_method_cookie_domain', None)
|
||||||
|
return 'document.cookie=`loops_auth_method=${this.value}; path=/; expires=Sun, 31 Jan 2027 12:00:00 UTC%s`' % (domain and f'; domain={domain}' or '')
|
||||||
|
|
||||||
|
|
||||||
def getConfigAuthMethod():
|
def getConfigAuthMethod():
|
||||||
return getattr(config, 'authentication_method', 'legacy')
|
return getattr(config, 'authentication_method', 'legacy')
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@
|
||||||
<select name="auth_method"
|
<select name="auth_method"
|
||||||
onchange="document.cookie=`loops_auth_method=${this.value}; path=/; expires=Sun, 31 Jan 2027 12:00:00 UTC`"
|
onchange="document.cookie=`loops_auth_method=${this.value}; path=/; expires=Sun, 31 Jan 2027 12:00:00 UTC`"
|
||||||
tal:define="meth view/authMethod"
|
tal:define="meth view/authMethod"
|
||||||
tal:attributes="value meth">
|
tal:attributes="value meth;
|
||||||
|
onchange view/authMethodCookieString">
|
||||||
<option value="legacy" i18n:translate="authentication-method-legacy"
|
<option value="legacy" i18n:translate="authentication-method-legacy"
|
||||||
tal:attributes="selected python:meth=='legacy'">Legacy</option>
|
tal:attributes="selected python:meth=='legacy'">Legacy</option>
|
||||||
<option value="oidc" i18n:translate="authentication-method-oidc"
|
<option value="oidc" i18n:translate="authentication-method-oidc"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue