Ticket #2498: md5secret.patch

File md5secret.patch, 4.5 kB (added by flewid, 4 years ago)

Patch File

  • functions.inc.php

    old new  
    10021002//  is "true" the correct value...? 
    10031003} 
    10041004 
    1005 //add to sip table 
    1006 function core_devices_addsip($account) { 
    1007   global $db; 
    1008   global $currentFile; 
     1005  //add to sip table 
     1006          function core_devices_addsip($account) { 
     1007          global $db; 
     1008          global $currentFile; 
     1009 
     1010          foreach ($_REQUEST as $req=>$data) { 
     1011          if ( substr($req, 0, 8) == 'devinfo_' ) { 
     1012          $keyword = substr($req, 8); 
     1013          if ( $keyword == 'dial' && $data == '' ) { 
     1014          $sipfields[] = array($account, $keyword, 'SIP/'.$account); 
     1015          } elseif ($keyword == 'mailbox' && $data == '') { 
     1016          $sipfields[] = array($account,'mailbox',$account.'@device'); 
     1017          } elseif ($keyword == 'md5secret' && $data != '') { 
     1018          $sipfields[] = array($account, 'md5secret', md5($account.':asterisk:'.$data)); 
     1019          } else { 
     1020          $sipfields[] = array($account, $keyword, $data); 
     1021          } 
     1022          } 
     1023          } 
    10091024 
    1010   foreach ($_REQUEST as $req=>$data) { 
    1011     if ( substr($req, 0, 8) == 'devinfo_' ) { 
    1012       $keyword = substr($req, 8); 
    1013       if ( $keyword == 'dial' && $data == '' ) { 
    1014         $sipfields[] = array($account, $keyword, 'SIP/'.$account); 
    1015       } elseif ($keyword == 'mailbox' && $data == '') { 
    1016         $sipfields[] = array($account,'mailbox',$account.'@device'); 
    1017       } else { 
    1018         $sipfields[] = array($account, $keyword, $data); 
    1019       } 
    1020     } 
    1021   } 
    1022    
    10231025  if ( !is_array($sipfields) ) { // left for compatibilty....lord knows why ! 
    10241026    $sipfields = array( 
    10251027      //array($account,'account',$account), 
    10261028      array($account,'accountcode',(isset($_REQUEST['accountcode']))?$_REQUEST['accountcode']:''), 
    10271029      array($account,'secret',(isset($_REQUEST['secret']))?$_REQUEST['secret']:''), 
     1030      array($account,'md5secret', (isset($_REQUEST['md5secret']))? $_REQUEST['md5secret']:''), 
    10281031      array($account,'canreinvite',(isset($_REQUEST['canreinvite']))?$_REQUEST['canreinvite']:'no'), 
    10291032      array($account,'context',(isset($_REQUEST['context']))?$_REQUEST['context']:'from-internal'), 
    10301033      array($account,'dtmfmode',(isset($_REQUEST['dtmfmode']))?$_REQUEST['dtmfmode']:''), 
     
    28492852    if ( $display != 'extensions' ) { 
    28502853      $currentcomponent->addguielem($section, new gui_password('password', $password, 'User Password', _("A user will enter this password when logging onto a device.").' '.$fc_logon.' '._("logs into a device.").' '.$fc_logoff.' '._("logs out of a device."), '!isInteger() && !isWhitespace()', $msgInvalidExtPwd, true)); 
    28512854      // extra JS function check required for blank password warning -- call last in the onsubmit() function 
    2852       $currentcomponent->addjsfunc('onsubmit()', "\treturn checkBlankUserPwd();\n", 9); 
     2855      // $currentcomponent->addjsfunc('onsubmit()', "\treturn checkBlankUserPwd();\n", 9); 
    28532856    } 
    28542857    $currentcomponent->addguielem($section, new gui_textbox('name', $name, 'Display Name', 'The caller id name for calls from this user will be set to this name. Only enter the name, NOT the number.', '!isCallerID()', $msgInvalidDispName, false)); 
    28552858    $cid_masquerade = (trim($cid_masquerade) == $extdisplay)?"":$cid_masquerade; 
     
    29552958    // Some errors for the validation bits 
    29562959    $msgInvalidDTMFMODE = _("Please enter the dtmfmode for this device"); 
    29572960    $msgInvalidChannel = _("Please enter the channel for this device"); 
    2958     $msgConfirmSecret = _("You have not entered a Secret for this device, although this is possible it is generally bad practice to not assign a Secret to a device. Are you sure you want to leave the Secret empty?"); 
     2961    // $msgConfirmSecret = _("You have not entered a Secret for this device, although this is possible it is generally bad practice to not assign a Secret to a device. Are you sure you want to leave the Secret empty?"); 
    29592962    $msgInvalidSecret = _("Please enter a Secret for this device"); 
    29602963     
    29612964    // zap 
     
    29952998 
    29962999    // sip 
    29973000    $tmparr = array(); 
    2998     $tmparr['secret'] = array('value' => '', 'level' => 0, 'jsvalidation' => 'isEmpty() && !confirm("'.$msgConfirmSecret.'")', 'failvalidationmsg' => $msgInvalidSecret); 
     3001    $tmparr['secret'] = array('value' => '', 'level' => 0 ); 
     3002    $tmparr['md5secret'] = array('value' => '', 'level' => 0); 
    29993003    $tmparr['dtmfmode'] = array('value' => 'rfc2833', 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidDTMFMODE ); 
    30003004    $tmparr['canreinvite'] = array('value' => 'no', 'level' => 1); 
    30013005    $tmparr['context'] = array('value' => 'from-internal', 'level' => 1);