Ticket #2498: md5secret.patch
| File md5secret.patch, 4.5 kB (added by flewid, 4 years ago) |
|---|
-
functions.inc.php
old new 1002 1002 // is "true" the correct value...? 1003 1003 } 1004 1004 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 } 1009 1024 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 1023 1025 if ( !is_array($sipfields) ) { // left for compatibilty....lord knows why ! 1024 1026 $sipfields = array( 1025 1027 //array($account,'account',$account), 1026 1028 array($account,'accountcode',(isset($_REQUEST['accountcode']))?$_REQUEST['accountcode']:''), 1027 1029 array($account,'secret',(isset($_REQUEST['secret']))?$_REQUEST['secret']:''), 1030 array($account,'md5secret', (isset($_REQUEST['md5secret']))? $_REQUEST['md5secret']:''), 1028 1031 array($account,'canreinvite',(isset($_REQUEST['canreinvite']))?$_REQUEST['canreinvite']:'no'), 1029 1032 array($account,'context',(isset($_REQUEST['context']))?$_REQUEST['context']:'from-internal'), 1030 1033 array($account,'dtmfmode',(isset($_REQUEST['dtmfmode']))?$_REQUEST['dtmfmode']:''), … … 2849 2852 if ( $display != 'extensions' ) { 2850 2853 $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)); 2851 2854 // 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); 2853 2856 } 2854 2857 $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)); 2855 2858 $cid_masquerade = (trim($cid_masquerade) == $extdisplay)?"":$cid_masquerade; … … 2955 2958 // Some errors for the validation bits 2956 2959 $msgInvalidDTMFMODE = _("Please enter the dtmfmode for this device"); 2957 2960 $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?"); 2959 2962 $msgInvalidSecret = _("Please enter a Secret for this device"); 2960 2963 2961 2964 // zap … … 2995 2998 2996 2999 // sip 2997 3000 $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); 2999 3003 $tmparr['dtmfmode'] = array('value' => 'rfc2833', 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidDTMFMODE ); 3000 3004 $tmparr['canreinvite'] = array('value' => 'no', 'level' => 1); 3001 3005 $tmparr['context'] = array('value' => 'from-internal', 'level' => 1);
