Skip to content

Commit d4f2d9d

Browse files
Shanly Suepaulcolans
authored andcommitted
Issue #1934348 by shanly: Don't call user_login_finalize() twice.
1 parent 174fa1f commit d4f2d9d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

simplesamlphp_auth.module

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ function simplesamlphp_auth_init() {
230230

231231
// Retrieve user mapping and attempt to log the user in.
232232
$ext_user = user_external_load($authname);
233+
$skip_user_finalization = FALSE;
233234

234235
if (!$ext_user) {
235236
// First we check the admin settings for simpleSAMLphp and find out if we are allowed to register users.
@@ -239,6 +240,7 @@ function simplesamlphp_auth_init() {
239240
_simplesaml_auth_debug(t('Register [%authname]', array('%authname' => $authname)));
240241

241242
user_external_login_register($authname, 'simplesamlphp_auth');
243+
$skip_user_finalization = TRUE;
242244

243245
if ($user) {
244246
// Populate roles based on configuration setting.
@@ -282,9 +284,12 @@ function simplesamlphp_auth_init() {
282284

283285
}
284286

285-
// Finalizing the login, calls hook_user op login.
287+
// Finalizing the login, calls hook_user op login.
288+
// user_external_login_register() calls this for us.
289+
if (!$skip_user_finalization) {
286290
$edit = array();
287291
user_login_finalize($edit);
292+
}
288293

289294
} // End if !empty authname.
290295
} // End if isset saml_session.

0 commit comments

Comments
 (0)