Jump to content

Manual login


00sapo

Recommended Posts

Hi,

I have to create a new custom page for login. It is an external page which makes a post to a php script in my module which checks password and email and if they are correct it redirect to the homepage. Instead the login doesn0t happen and the homepage is served as a gueast. I have checked email and password, so I know everything about the customer.

 

This is the code, where is the error?

 

Thanks :)

$context = Context::getContext();
$customer = new CustomerCore();
if (isset($_REQUEST['email']) && isset($_REQUEST['pass'])) {
    if (ValidateCore::isEmail($_REQUEST['email']) && ValidateCore::isPasswd($_REQUEST['pass'])) {
        if ($customer->getByEmail($_REQUEST['email'], $_REQUEST['pass'])) {
            $customer->logged = true;
            $context->customer = $customer;
            $cookie = $context->cookie;
            $cookie->id_customer = $customer->id;
            $cookie->customer_lastname = $customer->lastname;
            $cookie->customer_firstname = $customer->firstname;
            $cookie->logged = true;
            $cookie->email = $customer->email;
         }
    }

}
Edited by 00sapo (see edit history)
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...