Skip to content

Commit 64034cc

Browse files
committed
Add new parameter to determine if the account was created or already existed
1 parent fb75edc commit 64034cc

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

onelogin-saml-sso/php/functions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ function saml_acs() {
352352
}
353353

354354
$matcher = get_option('onelogin_saml_account_matcher');
355+
$newuser = false;
355356

356357
if (empty($matcher) || $matcher == 'username') {
357358
$matcherValue = $userdata['user_login'];
@@ -399,6 +400,7 @@ function saml_acs() {
399400
}
400401
}
401402
} else if (get_option('onelogin_saml_autocreate')) {
403+
$newuser = true;
402404
if (!validate_username($username)) {
403405
echo __("The username provided by the IdP"). ' "'. esc_attr($username). '" '. __("is not valid and can't create the user at wordpress");
404406
exit();
@@ -455,7 +457,7 @@ function saml_acs() {
455457
setcookie(SAML_NAMEID_SP_NAME_QUALIFIER_COOKIE, $auth->getNameIdSPNameQualifier(), time() + MONTH_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN, $secure, true);
456458
}
457459

458-
do_action( 'onelogin_saml_attrs', $attrs, wp_get_current_user(), get_current_user_id() );
460+
do_action( 'onelogin_saml_attrs', $attrs, wp_get_current_user(), get_current_user_id(), $newuser);
459461

460462
// Trigger the wp_login hook used by wp_signon()
461463
// @see https://developer.wordpress.org/reference/hooks/wp_login/

0 commit comments

Comments
 (0)