You are here

function ga_login_create_form_validate in Google Authenticator login 7

Validation handler to create a new code.

File

./ga_login.pages.inc, line 246
ga_login pages.

Code

function ga_login_create_form_validate($form, &$form_state) {
  if ($form_state['step'] == '2' && !form_get_errors()) {
    $uid = $form_state['values']['uid'];
    $account = user_load($uid);
    $username = _ga_login_username($account);
    $ga = _ga_login_get_class();
    $correct = $ga
      ->authenticateUser($username, $form_state['values']['verify_code'], $form_state['data']);
    if (!$correct) {
      form_set_error('verify_code', 'The code you entered was not valid, you must enter the code generated by your authenticator to continue');
    }
  }
}