commit a8ed3f832b7f54b8486e3e3d3b7d45f0e4b66b7c Author: Joel Pittet Date: Tue Oct 7 09:57:46 2014 -0700 coding standards cleanup diff --git a/login_one_time.module b/login_one_time.module index a9c4b03..caa91ea 100755 --- a/login_one_time.module +++ b/login_one_time.module @@ -174,8 +174,8 @@ function login_one_time_settings() { ); $form['user']['login_one_time_user_ignore_current_pass'] = array( '#type' => 'checkbox', - '#title' => t("Ignore the current password field"), - '#description' => t("Will ignore and hide the current password field when on the user edit page."), + '#title' => t('Ignore the current password field'), + '#description' => t('Will ignore and hide the current password field when on the user edit page.'), '#default_value' => variable_get('login_one_time_user_ignore_current_pass', FALSE), ); @@ -233,7 +233,8 @@ function login_one_time_button($username = NULL, $path = NULL, $select = FALSE, // Woops, they've supplied an $account! $username = $username->name; } - return drupal_render(drupal_get_form('login_one_time_button_form', $username, $path, $select, $set_mail)); + $form = drupal_get_form('login_one_time_button_form', $username, $path, $select, $set_mail); + return drupal_render($form); } return NULL; } @@ -712,13 +713,11 @@ function login_one_time_page($uid, $timestamp, $hashed_pass) { } module_invoke_all('login_one_time_used', $user); - - // Add a session variable indicating whether the ignore current password field setting is enabled. - $_SESSION['ignore_current_pass'] = variable_get('login_one_time_user_ignore_current_pass', FALSE); - - drupal_set_message(t('You have just used your one-time login link.')); - - if (!empty($action)) { + + // Add a session variable indicating whether the ignore current password field setting is enabled. + $_SESSION['ignore_current_pass'] = variable_get('login_one_time_user_ignore_current_pass', FALSE); + drupal_set_message(t('You have just used your one-time login link.')); + if (!empty($action)) { drupal_goto($action); } else { @@ -889,21 +888,20 @@ function login_one_time_block_view($delta = '') { /** * Implements hook_form_FORM_ID_alter(). */ -function login_one_time_form_user_profile_form_alter(&$form, &$form_state) -{ - // Remove the current password field from user profile edit form +function login_one_time_form_user_profile_form_alter(&$form, &$form_state) { + // Remove the current password field from user profile edit form // and disable validation. - if (variable_get('login_one_time_user_ignore_current_pass', FALSE) && isset($_SESSION['ignore_current_pass']) && $_SESSION['ignore_current_pass']) - { + if (variable_get('login_one_time_user_ignore_current_pass', FALSE) && isset($_SESSION['ignore_current_pass']) && $_SESSION['ignore_current_pass']) { // Check for the current password validation hook, and disable it. $key = array_search('user_validate_current_pass', $form['#validate']); - - if ($key !== FALSE) - unset($form['#validate'][$key]); - + + if ($key !== FALSE) { + unset($form['#validate'][$key]); + } + // Disable the current password form. $form['account']['current_pass_required_value']['#access'] = FALSE; - $form['account']['current_pass']['#access'] = FALSE; + $form['account']['current_pass']['#access'] = FALSE; } } @@ -1006,5 +1004,5 @@ function login_one_time_send_mail_action_submit($form, $form_state) { * Array with parameters for this action: depends on the trigger. */ function login_one_time_send_mail_action(&$account, $context = array()) { - login_one_time_send_mail($account, $context['path']); + login_one_time_send_mail($account, $context['path']); }