You are here

function aes_user_view in AES encryption 7

Implements hook_user_view().

File

./aes.module, line 120
Main file of the AES encryption module.

Code

function aes_user_view($account, $view_mode, $langcode) {
  $viewing_method = variable_get("aes_viewing_method", "page");
  if (user_access('view passwords') && ($viewing_method == "inplace" || $viewing_method == "both") && variable_get("aes_convert", FALSE)) {
    if (aes_password_exists($account->uid)) {
      drupal_add_library('system', 'drupal.ajax');
      $link = l(t('Show password'), 'aes_get_password_callback/' . $account->uid . '/nojs/', array(
        'attributes' => array(
          'class' => array(
            'use-ajax',
          ),
        ),
      ));
      $account->content['info']['aes_password'] = array(
        '#type' => 'user_profile_item',
        '#title' => t('AES Encryption'),
        '#markup' => '<div id="aes_password">' . $link . '</div>',
      );
    }
    else {
      $account->content['info']['aes_password'] = array(
        '#type' => 'user_profile_item',
        '#title' => t('AES Encryption'),
        '#markup' => t("This user's password does not yet exist in AES encrypted form."),
      );
    }
  }
}