Adding Features

Discussion in 'General' started by alexillsley, Dec 23, 2006.

  1. alexillsley

    alexillsley ISPConfig Developer ISPConfig Developer

    How could i add a "Forgott My Password" buton, i know how i would send emails via php but how would i get the users password,username,email. As i would like to have it when you press forgott by password it asks for the username and sends it there password to the users email

    i would have a phpscript something like this:
    PHP:
    <?php
    $username 
    $_POST['user'];
    $password "HOW DO I GET USERS PASS";
    $email "HOW DO I GET USERS EMAIL";

    $message "Hello, \n You have requested your password: 2\n  Your Password is: ".$password;
    mail($email'Forgotten Password'$message);

    ?>
     
  2. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Are you talking about the client or reseller password or the password of a email user account?
     
  3. alexillsley

    alexillsley ISPConfig Developer ISPConfig Developer

    Yep, the clients password
     
  4. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    All clients and reseller passwords are stored md5 encrypted in the database table sys_user, so you can not get the original password back. I recommend to create a new password instead and send this newly created password to the client.
     
  5. alexillsley

    alexillsley ISPConfig Developer ISPConfig Developer

    Thanks, how would i save the users changed password? And find form the username there email address
    Thanks again

    Heres my script that should work, just needs a few more varibles
    PHP:
    <?php
    // Make Password
    $salt "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789"
    srand((double)microtime()*1000000); // start the random generator
    $password=""// set the inital variable
    for ($i=0;$i<6;$i++)  $password $password substr ($saltrand() % strlen($salt), 1);

    // Varibles
    $newpass md5($password);
    $username $_POST['user'];
    $email "???";

    $message "Hello, \n You have we have automatically changed your password as you appear to have forgooten it: 2\n  Your New Password is: ".$newpass;
    mail($email'Forgotten Password'$message);

    ?>
     
  6. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    I guess you mix up client paswords with email passwords. Client passwords are not encrypted with crypt and clients do not nescesarily have a email address, clients are referenced by their username, the clients email address is optional.
     
  7. alexillsley

    alexillsley ISPConfig Developer ISPConfig Developer

    I think ill just leave this then, sounds like it wouldnt work easily:(
    thanks anyway
     

Share This Page