plugins/yubikey/corelib.php
changeset 29 7cd9707ed72f
parent 27 647f0aa485dd
child 35 03d6287d4a8b
equal deleted inserted replaced
28:b9a3da602841 29:7cd9707ed72f
    13   global $lang;
    13   global $lang;
    14   
    14   
    15   $fid = substr(sha1(microtime() . mt_rand()), 0, 12);
    15   $fid = substr(sha1(microtime() . mt_rand()), 0, 12);
    16   $class = $value ? 'wasfull' : 'wasempty';
    16   $class = $value ? 'wasfull' : 'wasempty';
    17   $html = '<input id="yubifield' . $fid . '" class="' . $class . '" type="hidden" name="' . $name . '" value="' . ( is_string($value) ? $value : '' ) . '" />';
    17   $html = '<input id="yubifield' . $fid . '" class="' . $class . '" type="hidden" name="' . $name . '" value="' . ( is_string($value) ? $value : '' ) . '" />';
       
    18   $html .= '<noscript><input type="text" name="' . $name . '" class="yubikey_noscript" value="' . ( is_string($value) ? $value : '' ) . '" /> </noscript>';
    18   if ( $value )
    19   if ( $value )
    19   {
    20   {
    20     $html .= '<span id="yubistat' . $fid . '" class="yubikey_status enrolled">' . $lang->get('yubiauth_ctl_status_enrolled') . '</span>';
    21     $html .= '<span id="yubistat' . $fid . '" class="yubikey_status enrolled">' . $lang->get('yubiauth_ctl_status_enrolled') . '</span>';
    21     $atext = $lang->get('yubiauth_ctl_btn_change_key');
    22     $atext = $lang->get('yubiauth_ctl_btn_change_key');
    22     $classadd = ' abutton_green';
    23     $classadd = ' abutton_green';
    32   {
    33   {
    33     $html .= ' <a class="abutton abutton_red yubikey_enroll" onclick="yk_clear(\'yubifield' . $fid . '\', \'yubistat' . $fid . '\'); return false;" href="#enroll">'
    34     $html .= ' <a class="abutton abutton_red yubikey_enroll" onclick="yk_clear(\'yubifield' . $fid . '\', \'yubistat' . $fid . '\'); return false;" href="#enroll">'
    34              . $lang->get('yubiauth_ctl_btn_clear') .
    35              . $lang->get('yubiauth_ctl_btn_clear') .
    35              '</a>';
    36              '</a>';
    36   }
    37   }
    37   $html = '<noscript><input type="text" name="' . $name . '" class="yubikey_noscript" value="' . ( is_string($value) ? $value : '' ) . '" /> </noscript>'
       
    38           . $html; // '<script type="text/javascript">document.write(unescape("' . rawurlencode($html) . '"));</script>';
       
    39   return $html;
    38   return $html;
    40 }
    39 }
    41 
    40 
    42 function yubikey_validate_otp($otp)
    41 function yubikey_validate_otp($otp)
    43 {
    42 {