login logic on controller.php