@@ -274,6 +274,8 @@ function simplesamlphp_auth_form_alter(&$form, $form_state, $form_id) {
274
274
return;
275
275
}
276
276
277
+ $is_user_profile_account_form = (($form_id == 'user_profile_form') && ($form['#user_category'] == 'account'));
278
+
277
279
$login_path = variable_get('simplesamlphp_auth_login_path', 'saml_login');
278
280
$login_name = variable_get('simplesamlphp_auth_login_link_display_name', t('Federated Log In'));
279
281
$link = l($login_name, $login_path);
@@ -289,7 +291,7 @@ function simplesamlphp_auth_form_alter(&$form, $form_state, $form_id) {
289
291
$form['links']['#markup'] = $link;
290
292
}
291
293
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')) {
293
295
$form['saml'] = array(
294
296
'#type' => 'checkbox',
295
297
'#title' => t('Enable this user to leverage SAML authentication'),
@@ -302,7 +304,7 @@ function simplesamlphp_auth_form_alter(&$form, $form_state, $form_id) {
302
304
// them to know their Drupal password. This will allow them to change their
303
305
// e-mail address, and set a Drupal password if they want to (and are
304
306
// 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)) {
306
308
307
309
unset($form['account']['current_pass']);
308
310
unset($form['account']['current_pass_required_values']);
0 commit comments