Closed jobasco closed 2 years ago
Hi,
it seems your login form not contain email field or the name is not exactly email.
@zfarkas88 the code is locate at mine controller page AuthController.php and form will be at login.html . Please help. how do i go about this?
Github is not the appropriate place to discuss your problem beacuse It is not a PHP-Auth issue.
I'm not familiar with the mentioned framework. What is in your login.html?
@jobasc0,
It's hard to help anyone when they don't do the basics:
In the future, when posting code to Github issues, please wrap your code in the triple backticks aka ` three times. It should go without saying, but you really should remove any sensitive information from anything you post here. Without wrapping your code in the ` code goes here
, causes major readability problems or in the case of your HTML, complete destruction of the code you are trying to show us. Take a half hour to read over how to use a markdown editor.
This issue isn't with Fat Free Framework or PHPAuth so this issue should be closed out. but I'll give you a hint:
If you are finding that $_POST array is empty or doesn't have your expected values, you need to back to the basics and try and understand if your form is actually posting to PHP the way you think it is. Here's a good resource that explains better what I'm talking about: https://stackoverflow.com/questions/4526273/what-does-enctype-multipart-form-data-mean.
Depending on how your form is constructed, you may be sending with a different encoding type. This happens often when people copy/paste code from examples they see online.
A great explainer on POSTed data from forms via PHP. https://stackoverflow.com/questions/8893574/php-php-input-vs-post
Hope this helps, but I think this issue should be closed out.
Thank you, @maietta and @zfarkas88 !
Hi, i am very new to php and i am trying to use F3 (fatfree framework) with Delite-im/Php-Auth and i am getting this error on my controller.php page. Undefined array key "email" This is the code. public function login() { // $db = new \PDO('mysql:dbname=my-database;host=localhost;charset=utf8mb4', 'my-username', 'my-password'); // or // $db = new \PDO('pgsql:dbname=my-database;host=localhost;port=5432', 'my-username', 'my-password'); // or // $db = new \PDO('sqlite:../Databases/my-database.sqlite'); // or $db = \Delight\Db\PdoDatabase::fromDsn(new \Delight\Db\PdoDsn('mysql:dbname=wapknhmx_igni173;host=localhost;charset=utf8mb4', 'wapknhmx_igni173', '2m8Ds@]5t1@zpS.-')); // or // $db = \Delight\Db\PdoDatabase::fromDsn(new \Delight\Db\PdoDsn('pgsql:dbname=my-database;host=localhost;port=5432', 'my-username', 'my-password')); // or // $db = \Delight\Db\PdoDatabase::fromDsn(new \Delight\Db\PdoDsn('sqlite:../Databases/my-database.sqlite')); $auth = new \Delight\Auth\Auth($db); try { $auth->login($_POST['email'], $_POST['password']); echo 'User is logged in'; } catch (\Delight\Auth\InvalidEmailException $e) { die('Wrong email address'); } catch (\Delight\Auth\InvalidPasswordException $e) { die('Wrong password'); } catch (\Delight\Auth\EmailNotVerifiedException $e) { die('Email not verified'); } catch (\Delight\Auth\TooManyRequestsException $e) { die('Too many requests'); } $ms->addMessageTranslated('success', 'WELCOME', $currentUser->toArray()); // Set redirect, if relevant $redirectOnLogin = $this->ci->get('redirect.onLogin'); return $redirectOnLogin($request, $response, $args); } } Please help. i will be very greatful i can get a full working login/register page example. Thanks