Skip to content

Commit 5dfe3b5

Browse files
authored
Bugfix: Fix use of back-button (#1769)
* Reset submit-button on back-button * Fix back-button for test-authsource page for non SP-sources * Update changelog
1 parent 4afecea commit 5dfe3b5

5 files changed

Lines changed: 29 additions & 15 deletions

File tree

docs/simplesamlphp-changelog.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
This document lists the changes between versions of SimpleSAMLphp.
66
See the upgrade notes for specific information about upgrading.
77

8+
## Version 2.0.1
9+
10+
* Several issues regarding the use of the back-button were fixed (#1720)
11+
* Many fixes in documentation
12+
* Fixed config/authsources.php.dist so you can just rename it for new deployments to get you started (#1771)
13+
814
## Version 2.0.0
915

1016
* Many changes, upgrades and improvements since the 1.x series.
@@ -16,7 +22,7 @@ See the upgrade notes for specific information about upgrading.
1622
* Code cleanups, improvements and simplifications.
1723
* Improved test coverage and more use of standard libraries.
1824
* Compatibility with modern versions of PHP.
19-
* Variouw new features, including:
25+
* Various new features, including:
2026
* SAML SubjectID and Pairwise ID support
2127
* Accepting unsolicited responses can be disabled by setting `enable_unsolicited` to `false` in the SP authsource.
2228
* Certificates and private keys can now be retrieved from a database

modules/admin/src/Controller/Test.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ public function main(Request $request, string $as = null): Response
136136
$params = [
137137
'ErrorURL' => $url,
138138
'ReturnTo' => $url,
139+
Auth\State::RESTART => $url,
139140
];
140141
return new RunnableResponse([$authsource, 'login'], [$params]);
141142
}
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
ready(function () {
2-
var button = document.getElementById("submit_button");
3-
button.onclick = function () {
4-
this.innerHTML = button.getAttribute("data-processing");
5-
this.disabled = true;
2+
window.onpageshow = function () {
3+
var button = document.getElementById("submit_button");
4+
button.innerHTML = button.getAttribute('data-default');
5+
button.disabled = false;
6+
}
67

7-
var form = document.getElementById("f");
8-
form.submit();
9-
return true;
10-
};
8+
var form = document.getElementById("f");
9+
form.onsubmit = function () {
10+
var button = document.getElementById("submit_button");
11+
button.innerHTML = button.getAttribute("data-processing");
12+
button.disabled = true;
13+
}
1114
});
1215

modules/core/templates/loginuserpass.twig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
{% if rememberOrganizationEnabled is defined -%}
9393
<div class="pure-controls">
9494
<label for="remember_organization" class="pure-checkbox">
95-
<input type="checkbox" id="remember_organization" tabindex="5" name="remember_organization" value="Yes"
96-
{{ rememberOrganizationChecked ? 'checked="checked"' }} >
95+
<input type="checkbox" id="remember_organization" tabindex="5" name="remember_organization"
96+
value="Yes" {{ rememberOrganizationChecked ? 'checked="checked"' }} >
9797
<small>{{ 'Remember my organization'|trans }}</small>
9898
</label>
9999
</div>
@@ -103,7 +103,8 @@
103103

104104
<div class="pure-control-group center login-form-submit">
105105
<button class="pure-button pure-button-red pure-input-1-2 pure-input-sm-1-1 right" id="submit_button"
106-
type="submit" tabindex="6" data-processing="{% trans %}Processing...{% endtrans %}">
106+
type="submit" tabindex="6" data-default="{% trans %}Login{% endtrans %}"
107+
data-processing="{% trans %}Processing...{% endtrans %}">
107108
{% trans %}Login{% endtrans %}
108109
</button>
109110
</div>

src/SimpleSAML/Auth/Simple.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,12 @@ public function login(array $params = []): void
153153
$errorURL = null;
154154
}
155155

156-
157-
if (!isset($params[State::RESTART]) && is_string($returnTo)) {
156+
$as = $this->getAuthSource();
157+
if (
158+
$as instanceof Module\saml\Auth\Source\SP
159+
&& !isset($params[State::RESTART])
160+
&& is_string($returnTo)
161+
) {
158162
/*
159163
* A URL to restart the authentication, in case the user bookmarks
160164
* something, e.g. the discovery service page.
@@ -163,7 +167,6 @@ public function login(array $params = []): void
163167
$params[State::RESTART] = $restartURL;
164168
}
165169

166-
$as = $this->getAuthSource();
167170
$as->initLogin($returnTo, $errorURL, $params);
168171
Assert::true(false);
169172
}

0 commit comments

Comments
 (0)