Skip to content

Commit 2949ed2

Browse files
jiffBalazs Dianiska
authored andcommitted
Issue #2545602 by jiff: Incompatibility with profile2
1 parent da6f589 commit 2949ed2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

simplesamlphp_auth.module

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ function simplesamlphp_auth_form_alter(&$form, $form_state, $form_id) {
274274
return;
275275
}
276276

277+
$is_user_profile_account_form = (($form_id == 'user_profile_form') && ($form['#user_category'] == 'account'));
278+
277279
$login_path = variable_get('simplesamlphp_auth_login_path', 'saml_login');
278280
$login_name = variable_get('simplesamlphp_auth_login_link_display_name', t('Federated Log In'));
279281
$link = l($login_name, $login_path);
@@ -289,7 +291,7 @@ function simplesamlphp_auth_form_alter(&$form, $form_state, $form_id) {
289291
$form['links']['#markup'] = $link;
290292
}
291293

292-
if (($form_id == 'user_register_form' || $form_id == 'user_profile_form') && user_access('change saml authentication setting')) {
294+
if (($form_id == 'user_register_form' || $is_user_profile_account_form) && user_access('change saml authentication setting')) {
293295
$form['saml'] = array(
294296
'#type' => 'checkbox',
295297
'#title' => t('Enable this user to leverage SAML authentication'),
@@ -302,7 +304,7 @@ function simplesamlphp_auth_form_alter(&$form, $form_state, $form_id) {
302304
// them to know their Drupal password. This will allow them to change their
303305
// e-mail address, and set a Drupal password if they want to (and are
304306
// allowed).
305-
if ((isset($form['#user']->init) && $form['#user']->init) && (_simplesaml_auth_user_has_authmap($form['#user']->init) && $form_id == 'user_profile_form')) {
307+
if ($is_user_profile_account_form && (isset($form['#user']->init) && $form['#user']->init) && _simplesaml_auth_user_has_authmap($form['#user']->init)) {
306308

307309
unset($form['account']['current_pass']);
308310
unset($form['account']['current_pass_required_values']);

0 commit comments

Comments
 (0)