Jump to content

removing order form password


payam98

Recommended Posts

hi everyone , i want to remove password filed from the order form ! i can hide it but still the error will be there ! so client cannot submit the order. i want to know how can i remove completely ?

 

or please tell me how can do something to generate automatic password ? i mean after client order the password will be generate automatically and send it to the client email.

 

its very important for me :?:

Link to comment
Share on other sites

generate the password and pass it to your template/URL using ActionHook:ClientAreaPageCart

 

<?php

add_hook("ClientAreaPageCart", 1, function($vars){
   $generatedPassword = '';
   return array("generatedpassword" => $generatedpassword);
});

 

then edit /templates/orderforms/standards/checkout.tpl, replace:

<input type="password" name="password" id="inputNewPassword1" class="field" placeholder="{$LANG.clientareapassword}">

with:

<input type="hidden" name="password" id="inputNewPassword1" class="field" placeholder="{$LANG.clientareapassword}" value="{$generatedpassword}">

 

and:

<input type="password" name="password2" id="inputNewPassword2" class="field" placeholder="{$LANG.clientareaconfirmpassword}">

with:

<input type="hidden" name="password2" id="inputNewPassword2" class="field" placeholder="{$LANG.clientareaconfirmpassword}" value="{$generatedpassword}">

 

this way the password inputs will be hidden with a value, later you can send this password to client by email

Link to comment
Share on other sites

first of all thanks for your answer dear.

 

just one thing i didn't understand the first part because i am too beginner. can u explain me little more what is the ActionHook:ClientAreaPageCart and where should i put the php code ?

Link to comment
Share on other sites

generate the password and pass it to your template/URL using ActionHook:ClientAreaPageCart

 

<?php

add_hook("ClientAreaPageCart", 1, function($vars){
   $generatedPassword = '';
   return array("generatedpassword" => $generatedpassword);
});

 

then edit /templates/orderforms/standards/checkout.tpl, replace:

<input type="password" name="password" id="inputNewPassword1" class="field" placeholder="{$LANG.clientareapassword}">

with:

<input type="hidden" name="password" id="inputNewPassword1" class="field" placeholder="{$LANG.clientareapassword}" value="{$generatedpassword}">

 

and:

<input type="password" name="password2" id="inputNewPassword2" class="field" placeholder="{$LANG.clientareaconfirmpassword}">

with:

<input type="hidden" name="password2" id="inputNewPassword2" class="field" placeholder="{$LANG.clientareaconfirmpassword}" value="{$generatedpassword}">

 

this way the password inputs will be hidden with a value, later you can send this password to client by email

 

can u explain me little more what is the ActionHook:ClientAreaPageCart and where should i put the php code ?

Link to comment
Share on other sites

create new php file inside /includes/hooks/ directory (eg: generateRandomPassword.php) and put the following code inside:

 

<?php 

add_hook("ClientAreaPageCart", 1, function($vars){ 
   $passwordLength = 10;
   $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
   $charactersLength = strlen($characters);
   $generatedPassword = '';
   for ($i = 0; $i < $passwordLength; $i++) {
       $generatedPassword .= $characters[rand(0, $charactersLength - 1)];
   } 
   return array("generatedpassword" => $generatedpassword); 
});

Link to comment
Share on other sites

create new php file inside /includes/hooks/ directory (eg: generateRandomPassword.php) and put the following code inside:

 

<?php 

add_hook("ClientAreaPageCart", 1, function($vars){ 
   $passwordLength = 10;
   $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
   $charactersLength = strlen($characters);
   $generatedPassword = '';
   for ($i = 0; $i < $passwordLength; $i++) {
       $generatedPassword .= $characters[rand(0, $charactersLength - 1)];
   } 
   return array("generatedpassword" => $generatedpassword); 
});

 

i did everything u said but still the error comes: You did not enter a password!

 

what should i do?

Link to comment
Share on other sites

try this instead....

 

<?php 

add_hook("ClientAreaPageCart", 1, function($vars){ 
   $passwordLength = 10;
   $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
   $charactersLength = strlen($characters);
   $generatedPassword = '';
   for ($i = 0; $i < $passwordLength; $i++) {
       $generatedPassword .= $characters[mt_rand(0, $charactersLength - 1)];
   } 
   return array("generatedpassword" => $generatedPassword); 
});

Link to comment
Share on other sites

try this instead....

 

<?php 

add_hook("ClientAreaPageCart", 1, function($vars){ 
   $passwordLength = 10;
   $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
   $charactersLength = strlen($characters);
   $generatedPassword = '';
   for ($i = 0; $i < $passwordLength; $i++) {
       $generatedPassword .= $characters[mt_rand(0, $charactersLength - 1)];
   } 
   return array("generatedpassword" => $generatedPassword); 
});

 

its not work again! (You did not enter a password)

its my website: http://vezeh.com/aa/whmcs/cart.php

 

what should i do ?? my version is 6.3.1

Link to comment
Share on other sites

try this instead!

<?php  

add_hook("ClientAreaPage", 1, function($vars){
   if ($vars['filename']!="cart"){
       return;
   }
   $passwordLength = 10; 
   $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 
   $charactersLength = strlen($characters); 
   $generatedPassword = ''; 
   for ($i = 0; $i < $passwordLength; $i++) { 
       $generatedPassword .= $characters[mt_rand(0, $charactersLength - 1)]; 
   }  
   return array("generatedpassword" => $generatedPassword);  
});

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated