diff --git a/drupal/sites/default/boinc/modules/boincuser/boincuser.module b/drupal/sites/default/boinc/modules/boincuser/boincuser.module index 874b87bbf4..40fdf6e1a5 100644 --- a/drupal/sites/default/boinc/modules/boincuser/boincuser.module +++ b/drupal/sites/default/boinc/modules/boincuser/boincuser.module @@ -108,6 +108,14 @@ function boincuser_menu() { 'type' => MENU_LOCAL_TASK, 'weight' => 5 ); + $items['user/login/auth'] = array( + 'title' => bts('Authenticator login'), + 'description' => 'Log in using a user authenticator', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('boincuser_authloginform'), + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK, + ); $items['user_control'] = array( 'page callback' => 'boincuser_control', 'access arguments' => array('access user profiles'), @@ -933,7 +941,15 @@ function boincuser_form_alter(&$form, $form_state, $form_id) { '#size' => 60, '#maxlength' => EMAIL_MAX_LENGTH, '#required' => TRUE, - '#description' => bts('Enter your email address to receive instructions for resetting your password.') + '#description' => bts( + 'Enter your email address to receive instructions for resetting your password (or use the !authenticator_login).', + array( + '!authenticator_login' => l( + bts('authenticator-based login'), + 'user/login/auth' + ) + ) + ), ), )); diff --git a/drupal/sites/default/boinc/modules/boincuser/includes/boincuser.forms.inc b/drupal/sites/default/boinc/modules/boincuser/includes/boincuser.forms.inc index 024c290f3f..8b897f1464 100644 --- a/drupal/sites/default/boinc/modules/boincuser/includes/boincuser.forms.inc +++ b/drupal/sites/default/boinc/modules/boincuser/includes/boincuser.forms.inc @@ -402,15 +402,15 @@ function boincuser_request_pass_validate($form, &$form_state) { function boincuser_authloginform() { $form['heading'] = array( '#type' => 'markup', - '#value' => '

' . bts("2) If you forgot your account's email address, or you can't receive email there:") . '

' + '#value' => '

' . bts("If you forgot your account's email address, or you can't receive email there:") . '

' ); $form['instructions'] = array( '#type' => 'markup', '#value' => '' . '

' . bts("If you have run BOINC under the account, you can still access it. Here's how:") . '

' . @@ -435,9 +435,26 @@ function boincuser_authloginform() { '#required' => TRUE, '#description' => null ); + + // Form control + $form['form control tabs prefix'] = array( + '#value' => '', + '#weight' => 1004, ); return $form; } @@ -452,7 +469,7 @@ function boincuser_authloginform_validate($form, &$form_state) { form_set_error('authenticator', bts('That authenticator is not valid.')); } else { require_boinc('boinc_db'); - $boinc_user = BoincUser::lookup_auth($authenticator); + $boinc_user = BoincUser::lookup("authenticator='".addslashes($authenticator)."'"); if (!$boinc_user) form_set_error('authenticator', bts('There is no account with that authenticator.')); } } @@ -462,10 +479,11 @@ function boincuser_authloginform_validate($form, &$form_state) { */ function boincuser_authloginform_submit($form, &$form_state) { global $user; + $authenticator = $form_state['values']['authenticator']; require_boinc('boinc_db'); - $boinc_user = BoincUser::lookup_auth($form_state['values']['authenticator']); + $boinc_user = BoincUser::lookup("authenticator='".addslashes($authenticator)."'"); if (!$user = user_load(get_drupal_id($boinc_user->id))) drupal_set_message(t('An unresolved error occurred while logging into this account.')); - else $form_state['redirect'] = "user/{$user->uid}/edit"; + else $form_state['redirect'] = 'account/info/edit'; }