PHP Login using ISPConfig mail accounts

Discussion in 'General' started by dokov, Nov 23, 2013.

  1. dokov

    dokov New Member

    Hello.

    I am trying to develop a login system based on email accounts in ISPConfig 3.
    I've found the API of ISPConfig, but I couldn't find verification of email login.

    I saw the example with function mail_user_get, but it requires mailuser_id, not email and password.

    Please give me some advice.
     
  2. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    The "get" functions can get an array instead of the id. Like array('login' => 'myusername') then you can check the crypted password of the result.
     
  3. dokov

    dokov New Member

    Ok, I see this is nice.
    I get the user details, but how do I encode the password input so I can compare it to the email password from the database?

    Can you please give me an example code.
    Thanks!
     
  4. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    PHP:
    // this is the one from the dataset you got via api
    $saved_password stripslashes($mailuser['password']);

    $salt '$1$'.substr($saved_password38).'$';
    // this is the one you want to check
    $password crypt(stripslashes($login_password), $salt);

    if(
    $password == $saved_password) -> everything should be ok
     

Share This Page