Hi,
I have created simple registration page following steps in the tutorial https://olddocs.phalcon.io/en/3.0.3/reference/tutorial.html
I want to create simple login page, how can I check if the user exists in the database?
I have created SignupController and the form, but I have no idea how to pass form data into controller and show the results.
Here is my "try"., but I feel that I'm trying to do this wrong way.
<?php
use Phalcon\Mvc\Controller;
class LoginController extends Controller
{
public function indexAction()
{
}
public function loginAction()
{
if ($this->request->isPost()) {
$password = $this->request->getPost("password");
$email = $this->request->getPost("email");
}
$success = Users::findFirst(array(
"username = :username: AND email = :email:",
"bind" == array(
"username" => $username,
"email" => $email,
)));
if ($success) {
echo ('OK');
} else {
echo "Sorry, the following problems were generated: ";
$messages = $user->getMessages();
foreach ($messages as $message) {
echo $message->getMessage(), "<br/>";
}
}
$this->view->disable();
}
}
Thank you for help in advance, Regards!