Compare commits
2 commits
4572195ef5
...
bf954a9614
| Author | SHA1 | Date | |
|---|---|---|---|
| bf954a9614 | |||
| a548575704 |
2 changed files with 8 additions and 2 deletions
|
|
@ -49,12 +49,17 @@ 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')
|
||||||
|
|
||||||
def getAuthMethodCookieValue(request):
|
def getAuthMethodCookieValue(request):
|
||||||
return request.cookies.get('loops_auth_method') or 'legacy'
|
default = getattr(config, 'authentication_method_cookie_default', 'legacy')
|
||||||
|
return request.cookies.get('loops_auth_method') or default
|
||||||
|
|
||||||
|
|
||||||
# OIDC authentication
|
# OIDC authentication
|
||||||
|
|
|
||||||
|
|
@ -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