Compare commits

..

No commits in common. "bf954a961462f5817b1376d9f3c30a4a2ac61cbd" and "4572195ef5f677fe2b016bb84270f499c8c305e5" have entirely different histories.

2 changed files with 2 additions and 8 deletions

View file

@ -49,17 +49,12 @@ 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):
default = getattr(config, 'authentication_method_cookie_default', 'legacy') return request.cookies.get('loops_auth_method') or 'legacy'
return request.cookies.get('loops_auth_method') or default
# OIDC authentication # OIDC authentication

View file

@ -31,8 +31,7 @@
<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"