You are here

function mo_auth_user_management_submit in Google Authenticator / 2 Factor Authentication - 2FA 7

File

./mo_auth_user_management.inc, line 53
Contains support form for miniOrange 2FA Login Module.

Code

function mo_auth_user_management_submit($form, &$form_state) {
  $username = $form['mo_auth_reset_2fa_username']['#value'];
  $user = user_load_by_name($username);
  if ($user === FALSE) {
    drupal_set_message(t("User ") . "<strong>" . $username . "</strong>" . t(" not found."), 'error');
    return;
  }
  $edit['configured_auth_methods']['und'] = array();
  $edit['miniorange_registered_email']['und'] = array();
  user_save($user, $edit);
  drupal_set_message(t("You have reset the 2FA for ") . "<strong>" . $username . "</strong>" . t(" successfully."), 'status');
}