You are here

function _securesite_user_digest_cleanup in Secure Site 8

Same name and namespace in other branches
  1. 7.2 securesite.module \_securesite_user_digest_cleanup()

Manage a users stored password.

@todo more documentation would be useful.

See also

secure_user_insert

secure_user_update

secure_user_load

2 calls to _securesite_user_digest_cleanup()
securesite_user_form_submit in ./securesite.module
Callback when user updates his profile
securesite_user_login_submit in ./securesite.module
Callback when a user logs in through user_login form

File

./securesite.module, line 155
Enables HTTP authentication or an HTML form to restrict site access.

Code

function _securesite_user_digest_cleanup($edit) {
  $user = \Drupal::currentUser();
  $site_path = DrupalKernel::findSitePath(\Drupal::request());
  if (in_array(SECURESITE_DIGEST, \Drupal::config('securesite.settings')
    ->get('securesite_type')) && isset($edit['pass'])) {
    $edit['name'] = isset($edit['name']) ? $edit['name'] : $user
      ->getUsername();
    $script = \Drupal::config('securesite.settings')
      ->get('securesite_password_script');
    $values = array(
      'username=' . escapeshellarg($edit['name']),
      'realm=' . escapeshellarg(\Drupal::config('securesite.settings')
        ->get('securesite_realm')),
      'pass=' . escapeshellarg($edit['pass']),
      'op=create',
      'site_path=' . $site_path,
    );
    exec($script . ' ' . implode(' ', $values), $output, $status);

    /*    if ($user->getUsername() != $edit['name']) {
          securesite_user_delete($edit, $user);
        }*/
  }
}