hi @Alex Lancer, in your Route.php : $routes->get('/', 'Users::index'); this is not work for me, I change to : $routes->match(['get', 'post'], '/', 'Users::index') and it's works for me. Is that right ? Please comment, thank you.
Hi alex, every time I try to log in with credential right or wrong I get the message 404 and it tells me that "Can't find route for 'post: /.' I checked your code in github and it was exactly the same, do you know why tjis happens?
I found a solution for this from @fuchandraxing4512 : hi @Alex Lancer, in your Route.php : $routes->get('/', 'Users::index'); this is not work for me, I change to : $routes->match(['get', 'post'], '/', 'Users::index') and it's works for me.
Hi, Thanks for the great tutorial. I am getting error CodeIgniter\Validation\Exceptions\ValidationException is not a valid rule. SYSTEMPATH\Validation\Exceptions\ValidationException.php at line 10 How to fix ? I have check and I have typed everything same as yours but your is working and I get error!!!
Hi, I am at 22:17 into the video. When I log in, I am redirected to "localhost/login/dashboard" resulting in 404 error. But when I edit the address in firefox to "localhost/dashboard" the "Hello, Alex" message appears. Any tips on how I can fix this? Thanks
Hey Glen, check your redirect() method it should be redirect()->to('/dashboard') not redirect()->to('dashboard'). See the slash '/' before dashboard ? Tell me if that's the case.
@@AlexLancer Hi, I have changed it to "return redirect()->to('/dashboard');" and it is working now. Thanks. Just a heads up, in the video at 22:09 on line 37 it reads "return redirect()->to('dashboard');"
@@glennperete Yes because in my case it does not play any role ('dashboard') or ('/dashboard') But in your case, because you are on localhost/login (while in the video i am on localhost) you have to add '/' so that the app knows that you mean to redirect to the localhost/dashboard, if you dont add the slash it will concat the existing url + dashboard
Hey Alex! Great tutorial so far. I am having an issue at 11:05 where I am presented with a "The email field is required. The password field is required." instead of "Email or password don't match". I continued through and added the password_verify line to UserRules.php but I am still presented with "The email field is required. The password field is required." even though they are both supplied and correct. Any suggestions?
hi sir , i followed your tutorial. how do you set default localhost in codeigniter? i am using like this localhost:8080/users because of its i cannot redirect to next page after submit. it send next page like localhost/users
Hi Alex, Thank you for giving this very useful tutorial. but I found a problem with validateUser[email, password] which shows a mismatch. is this a problem with UserModel or UserRules? even though I've often compared your code.
Muhammad, do you mean that when you provide submit correct email & pass you still get validation error? If so please upload your code to github so that I can check it.
I got an interesting error bro. When i add the new code on my style.css did not load to html. First i went to page i inspect the link and the path was okay but showing just the body{ background-color: #e1e1e1; } without the new added code. Then i create a second css -> style2.css with the whole new code and it passed succesfully. But i can't understand why the new code is not loading at style.css
First of all thanks for watching. Now you know it can be a million things. 1st that comes to mind is browser caching. Maybe it got cached with an error and then you could not clear it. Also, are you using XAMPP or some live server for your development?
@@AlexLancer Well i have to thank you for spending your time to teach us. Well i use XAMPP for my development i tried also to stackoveflow it but the only thing that i found it was "checking the link" in my case link is okay. i doubt alson on broswer caching. Thanks for the fast replay.
@jasneet bhatia - did you get resolved? i have the same issue for the lock screen with pin . however user login is working perfectly. Thanks Alex for your great contributions and appreciated for the tutorials.
Alex - Great tutorial! I have a problem with picking up the custom css for the error messages on Login/Registration forms. I am adding the following to the head section (right under the bootstrap link) of Views/templates/header.php file: and there is a file by that name in that location, but I can't seem to access the styles. Any thoughts?
I was wondering and a little bit confused, you use CodeIgniter/Model in the model file but don't use CodeIgniter/Controller in the controller file. So what's the difference if using CodeIgniter/Controller instead to not using it? isn't that important?
Hey, Rifat, All of the controllers extend BaseController. If you go inside BaseController you will see that it extends Controller which is imported through "use Condigniter\Controller" So because my controllers extend BaseController it inherits the Codeigniter Controller from there. But good question! Well done!
@@AlexLancer Woah, I didn't pay attention to that! Thanks for the explanation. I am waiting for your next video. Can you explain about creating a progressive web application using CI4 for the next video? I always look for CI3 but I don't get a clear explanation. By the way, thank you very much!
hi Alex i have another issue i tried it lot but still not getting the clue why it is happening it is on git too on same repo also .what i try to achive is when user check the remember me in login page and submit in controller i set cookie with token and same token i want to update in database but update query not working with active record syntax.here is the code where i am stuck now if($this->request->getPost('remember')){ $token = random_string('md5', 32); set_cookie('remembermetoken', $token,'3600'); // with cookies working code
$User->set('remember_token',$token); $User->where('email',$this->request->getPost('email')); $User->update(); // the above three line of code produce //UPDATE `user` SET = '' WHERE `email` = 'pal@gmail.com' // why it is not setting remember_token //contrary to that if i use // $User->query("UPDATE `user` SET `remember_token`='".$token."' WHERE `email`= '".$this->request->getPost('email')."'"); // it will produce correct query ? //UPDATE `user` SET `remember_token`='d0dc17846d297bb28ac37e16e280060d' WHERE `email`= 'pal@gmail.com' echo $User->getLastQuery(); die;
Hi Kumar, try Because you are using the CodeIgniter Model class for your UserModel the update works like this $User->update($id, $data); $data is your data that you want to save. it is an array. $data = ['remember_token' => $token]; $id - is you user's id The way you used it in your code it would work if you would use it like: $db = db_connect(); $builder = $db->table('users'); $builder->set(bla bla)->where->(bla bla)->update();
Still facing the same issue Alex used this code as you said $newdata=['remember_token'=>$token]; $User->update($userdata['id'],$newdata); Now it produce this result UPDATE `user` SET = '' WHERE `user`.`id` IN ('5') still not setting the remember_me field in query checked my allowedfield in UserModel also there is remember_me in array but still not working dont understand what i m doing wrong same kind of code is working with recoverpassword() function of User controller but not here
it is solved thanks. In callback function in UserModel . i am not returning anything that is why it was not setting the data in query now done thanks again
Sir It would be great if you or some one reply me I have set session at local storage with browse close session destroy And I m running my project in local server With some ip 192.168.67.60/ci4 Some time session works properly for long time But sometimes suddenly session is destroy and user are logout Pls let me know Any settings
I love this video and the content . I'll go subscribe and turn notification so i can get notif if you publish another video. Keep the great work man. Good luck.
Argument 1 passed to App\Validation\UserRules::validateUser() must be of the type string, null given, called in public function validateUser(string $str, string $fields, array $data) the stranger thing is: works twice! in thirth try show previous error... i dont know why...
Hi! First, I want to thank you for what are you doing on your channel. It helps me, but now I have a problem with validateUser method, even if the password is correct , the form is not valid because the password and email don't mach. Can you please provide me a solution? Thank you in advance!
I will download your project files in GitHub and installed it then I chake it I will insert right password but he should display error email or password is not right
Hi Alex, I see you face an error on the line 33 because of the $model->model() whereas it should be $model->where() which I am not sure why did you only get the error now and not when you test the login function earlier. I should have just continued watching the whole video instead of spending 2 days to debug that issue. After I fixed it then I realized you had that error. omg
I had the same error and was caused by the password field set to varchar(50). I change it to varchar(255) and solved the problem. Alex your are a great instructor, Thanks a lot 👍👍👍👍👍
Alex first of all thanks for sharing such precious Knowledge with the world i am following your playlist of login registration and try to extend it bit by myself by involving forget password but i am having trouble in setting the cookies in ci4 here is bit sample code from my controller hope you get it helper('cookie'); $this->response->set_cookie('forgetpwd',$token, time() + (3600),"/",site_url()); print_r($this->request->get_cookie('forgetpwd')); die(); but it output blank
Hi, Kumar, thank for your kind words. Please upload your code to github so that i can analyze it. And also why do you use a cookie for 'Forgot password' ? What do you try to achieve? Thanks.
thanks it works thanks a lot Alex please make some community where we can discuss all such issues so that all of us can contribute to your efforts in CodeIgniter 4 related issue and discussions related to it
@@kumarpal8837 Thanks for the suggestion. For now the focus is to establish the community on RUclips. So please suggest my channel to others or share a video on your channel. That would be a great support for me. Thanks!
@@AlexLancer My mistake in "\App\Validation\UserRules::class", I am not check the path. Then the problem is when I type correct email and password look like in the database, it throw error "Email or Password don't match". I wish I could solve this small problem. Thank you for giving this great tutorial. Have a nice day :)
@@AlexLancer It has been resolved. It caused by bcrypt password. Is your code using auto bcrypt password for new user register? And add them into database. All user in my database table haven't password yet. I was trying make new user password from phpmyadmin without encrypted and i got these mismatch. However now I have to bcrypt password then paste it to user table.
@@sandeepkumarr1212 watch this video's intro starting at 1:00 shorturl.at/ayT59 and then go to 50:30 of the same video to see how to make a CustomModel (similar to CI3)
Thanks for Your reply on the matter. Here is the git link github.com/stackpalk/Codeigniter4.git there is .sql file also on root .What i try to achieve is simple i try to implement forget pwd functionality on first screen i send mail by taking email id of user with newly generated token which is valid for 1 hour only that's why i need to set cookie in browser to compare it with the token that i send in email to proceed further similarly cookies can be used to remember me at login screen by setting token and encrypted credential for the next login automatically which is the next task i am going to implement.Plz configure email by your credential. Thanks for your efforts and time Alex
Not bad, but NOT good. The biggest issue is that he doesn't explain ANYTHING he is doing, NOR WHY. It is like he is reading off of a script on another monitor, and already expects you to know the framework, keywords, methods, etc. It feels like he forgets that this is a Ci4 TUTORIAL, and NOT a HOW TO video. Or am I mistaken?? He also spends a LOT of time writing line after line of code without showing WHAT the code is actually doing as he writes it. Which is VERY difficult to learn by. One of the videos goes almost the entire length before testing it! A proper tutorial shows you progress every few minutes. He also makes TONS of mistakes and typos, that are easily caught right away, and then have to fast forward through later when he goes back to fix them. That is easily the most frustrating part. Bottom line - You really already need to be a PHP EXPERT, and FLUENT in Codeigniter 4 before watching this series. Otherwise you will be LOST. Too bad since not many RUclipsrs are covering Ci4 yet.
Friendly suggestion for you Sergio... Perhaps watch Alex’s series “CodeIgniter 4 from Scratch” first, then watch this series. You might feel differently about it then. I agree he makes typos, but he’s only human, we all do typos, and he shows how he spots them and corrects them, which is actually useful to a beginner.
Hi Alex, I discovered something interesting. In your video you outputted errors to view by using $data['validation'] = $this->validator; that way the whole validation object gets passed to view with all the rules and stuff. It might be much leaner by passing just the error array by doing $data['errors'] = $this->validator->geterrors(); Then In the view you can traverse through $errors array of key value pairs.
Bartlomiej, glad that you keep learning. Yes you are totally correct. The difference is that the errors I output are already with some predefined HTML, i believe as a UL->LI items. And actually you can create your own templates and then use it without foreach loop. But I also tend to use the getErrors method.
Alex, great tutorial! I have tried to make validation in the model for my registration view do i need to create seperate model for my login view now since validation will change? How do I create custom validation rule in the model?
Thinking about it still I'm wondering do we have to validate login credentials at all? after all they are not being saved anywhere just read and compared. simple html5 validation could suffice on a front-end side of things imho.
You can not rely on frontend validation at any point. Only backend validation. Now, the custom validation rule, can be just a simple method in your controller (or model) you don't need to make it a rule, as I showed in the tutorial, that was just an example, you can just create a method insider your file that will check that.
@@AlexLancer In that case would simple if else statement suffice? Like check if email and pass is there then if it is then if there is user with that email, compare pass if they match log in. anything else error? Looking at it ... it is what validation does anyways.
@@AlexLancer Thank you sorry for repeating it twice like this. I would want to reach the stage when i will be more productive and confident with writing code. Some days I write one line and I try to figure out what to do next and how to. How long did it take you to reach your level of proficiency?
hi @Alex Lancer,
in your Route.php :
$routes->get('/', 'Users::index');
this is not work for me, I change to :
$routes->match(['get', 'post'], '/', 'Users::index')
and it's works for me.
Is that right ?
Please comment, thank you.
Hi alex, every time I try to log in with credential right or wrong I get the message 404 and it tells me that "Can't find route for 'post: /.' I checked your code in github and it was exactly the same, do you know why tjis happens?
I got the same problem, did you manage to solve it?
I found a solution for this from @fuchandraxing4512 :
hi @Alex Lancer,
in your Route.php :
$routes->get('/', 'Users::index');
this is not work for me, I change to :
$routes->match(['get', 'post'], '/', 'Users::index')
and it's works for me.
Hi Alex, When I put the data correctly to login, I keep getting the validation error(Email or Password don't match).
Did you insert data into database manually or through registration form?
@@AlexLancer through registration form
Hi! I have the same problem and I really don't know how to fix it.. Can you please tell me how you resolve it? I will be very thankful
@@iulianab I'm having the same problem. Did anyone finf solution to this? Need help!
same error. Its something to do with the validateUser method.
Hi, Thanks for the great tutorial. I am getting error
CodeIgniter\Validation\Exceptions\ValidationException
is not a valid rule.
SYSTEMPATH\Validation\Exceptions\ValidationException.php at line 10
How to fix ? I have check and I have typed everything same as yours but your is working and I get error!!!
Hi, I am at 22:17 into the video. When I log in, I am redirected to "localhost/login/dashboard" resulting in 404 error. But when I edit the address in firefox to "localhost/dashboard" the "Hello, Alex" message appears. Any tips on how I can fix this? Thanks
Hey Glen, check your redirect() method it should be redirect()->to('/dashboard') not redirect()->to('dashboard'). See the slash '/' before dashboard ?
Tell me if that's the case.
@@AlexLancer Hi, I have changed it to "return redirect()->to('/dashboard');" and it is working now. Thanks. Just a heads up, in the video at 22:09 on line 37 it reads "return redirect()->to('dashboard');"
@@glennperete Yes because in my case it does not play any role ('dashboard') or ('/dashboard')
But in your case, because you are on localhost/login (while in the video i am on localhost) you have to add '/' so that the app knows that you mean to redirect to the localhost/dashboard, if you dont add the slash it will concat the existing url + dashboard
@@AlexLancer hii alex, I have changed (dashboard) to (/dashboard) still can't
Hey Alex! Great tutorial so far. I am having an issue at 11:05 where I am presented with a "The email field is required.
The password field is required." instead of "Email or password don't match". I continued through and added the password_verify line to UserRules.php but I am still presented with "The email field is required.
The password field is required." even though they are both supplied and correct. Any suggestions?
You must set id & name to the in the login.php view file.
help! i have an error "Call to undefined function set_value() " everytime I login.
hi sir , i followed your tutorial. how do you set default localhost in codeigniter? i am using like this localhost:8080/users because of its i cannot redirect to next page after submit. it send next page like localhost/users
i already followed your tutorial, but everytime i clicked that login button, it enters anyway even with random data (random username and password)
Hi Alex, Thank you for giving this very useful tutorial. but I found a problem with validateUser[email, password] which shows a mismatch. is this a problem with UserModel or UserRules? even though I've often compared your code.
i got same error
Muhammad, do you mean that when you provide submit correct email & pass you still get validation error? If so please upload your code to github so that I can check it.
@@AlexLancer I have solved it, thank you 😁
@@dengannama8987 Can you share what was causing it ?
@@AlexLancer I modified your codes into my model, and it's works 😅
I got an interesting error bro. When i add the new code on my style.css did not load to html.
First i went to page i inspect the link and the path was okay but showing just the
body{
background-color: #e1e1e1;
}
without the new added code.
Then i create a second css -> style2.css with the whole new code and it passed succesfully.
But i can't understand why the new code is not loading at style.css
First of all thanks for watching. Now you know it can be a million things. 1st that comes to mind is browser caching. Maybe it got cached with an error and then you could not clear it. Also, are you using XAMPP or some live server for your development?
@@AlexLancer Well i have to thank you for spending your time to teach us. Well i use XAMPP for my development i tried also to stackoveflow it but the only thing that i found it was "checking the link" in my case link is okay. i doubt alson on broswer caching. Thanks for the fast replay.
if you could share your code somewhere, it would help. Can you ?
Hi Thanks for great video but password verify function not returning anything..its always says that not match...am stuck here please help
@jasneet bhatia - did you get resolved? i have the same issue for the lock screen with pin . however user login is working perfectly. Thanks Alex for your great contributions and appreciated for the tutorials.
@@IRSHADJABBAR yes it was done
@@mrandmrsbhatia479 what changes you made
Hi axe , can you help me please
404
Can't find a route for 'post: /
validateUser function has error which allows incorrect password to login.....there is no else statement of " if(!$user) ".
Excelente Axel... la libreria Shopping Cart , no esta disponible en esta version? Sabes si existe alguna posibilidad de integrarla? Gracias
Hi Antonio, yes shopping card has been removed from Codeigniter 4. You can use other external libraries for that. I don't have a specific suggestion.
@@AlexLancer Thank you Alex.
Alex - Great tutorial!
I have a problem with picking up the custom css for the error messages on Login/Registration forms. I am adding the following to the head section (right under the bootstrap link) of Views/templates/header.php file: and there is a file by that name in that location, but I can't seem to access the styles. Any thoughts?
Facing the same problem, renamed it to "main.css" and it worked.
I was wondering and a little bit confused, you use CodeIgniter/Model in the model file but don't use CodeIgniter/Controller in the controller file. So what's the difference if using CodeIgniter/Controller instead to not using it? isn't that important?
Hey, Rifat,
All of the controllers extend BaseController. If you go inside BaseController you will see that it extends Controller which is imported through "use Condigniter\Controller"
So because my controllers extend BaseController it inherits the Codeigniter Controller from there. But good question! Well done!
@@AlexLancer Woah, I didn't pay attention to that! Thanks for the explanation. I am waiting for your next video. Can you explain about creating a progressive web application using CI4 for the next video? I always look for CI3 but I don't get a clear explanation. By the way, thank you very much!
hi Alex i have another issue i tried it lot but still not getting the clue why it is happening it is on git too on same repo also .what i try to achive is when user check the remember me in login page and submit in controller i set cookie with token and same token i want to update in database but update query not working with active record syntax.here is the code where i am stuck now
if($this->request->getPost('remember')){
$token = random_string('md5', 32);
set_cookie('remembermetoken', $token,'3600'); // with cookies working code
$User->set('remember_token',$token);
$User->where('email',$this->request->getPost('email'));
$User->update();
// the above three line of code produce
//UPDATE `user` SET = '' WHERE `email` = 'pal@gmail.com'
// why it is not setting remember_token
//contrary to that if i use
// $User->query("UPDATE `user` SET `remember_token`='".$token."' WHERE `email`= '".$this->request->getPost('email')."'");
// it will produce correct query ?
//UPDATE `user` SET `remember_token`='d0dc17846d297bb28ac37e16e280060d' WHERE `email`= 'pal@gmail.com'
echo $User->getLastQuery();
die;
}
Hi Kumar, try
Because you are using the CodeIgniter Model class for your UserModel
the update works like this
$User->update($id, $data);
$data is your data that you want to save. it is an array.
$data = ['remember_token' => $token];
$id - is you user's id
The way you used it in your code it would work if you would use it like:
$db = db_connect();
$builder = $db->table('users');
$builder->set(bla bla)->where->(bla bla)->update();
Hey hie Alex, I just want to validate session for all controllers. How can I do with CI4?
Plz guide
Still facing the same issue Alex used this code as you said
$newdata=['remember_token'=>$token];
$User->update($userdata['id'],$newdata);
Now it produce this result
UPDATE `user` SET = '' WHERE `user`.`id` IN ('5') still not setting the remember_me field in query checked my allowedfield in UserModel also there is remember_me in array but still not working dont understand what i m doing wrong same kind of code is working with recoverpassword() function of User controller but not here
The query that is being generated does not look correct
yes it is not producing the correct query . but why it is not producing the correct query this was the issue.
it is solved thanks. In callback function in UserModel . i am not returning anything that is why it was not setting the data in query now done thanks again
@@kumarpal8837 ooff, finally!
Sir
It would be great if you or some one reply me
I have set session at local storage with browse close session destroy
And I m running my project in local server
With some ip 192.168.67.60/ci4
Some time session works properly for long time
But sometimes suddenly session is destroy and user are logout
Pls let me know
Any settings
I love this video and the content . I'll go subscribe and turn notification so i can get notif if you publish another video. Keep the great work man. Good luck.
Argument 1 passed to App\Validation\UserRules::validateUser() must be of the type string, null given, called in
public function validateUser(string $str, string $fields, array $data)
the stranger thing is: works twice! in thirth try show previous error... i dont know why...
sorry logic error! fixed
Hi! First, I want to thank you for what are you doing on your channel. It helps me, but now I have a problem with validateUser method, even if the password is correct , the form is not valid because the password and email don't mach. Can you please provide me a solution? Thank you in advance!
hello! did you find a solution? im expriencing the same problem
@@plain3808 Did you find the solution to that, Now I'm having the same problem after watching the tutorial for all day. Stuck here.
Unable to get session value in another controller, Please help.
Hey Bhuvnesh, upload your code on gihub and describe the issue in detail please.
I will download your project files in GitHub and installed it then I chake it I will insert right password but he should display error email or password is not right
Sollu this error and reply me fast
Hi Alex, I see you face an error on the line 33 because of the $model->model() whereas it should be $model->where() which I am not sure why did you only get the error now and not when you test the login function earlier. I should have just continued watching the whole video instead of spending 2 days to debug that issue. After I fixed it then I realized you had that error. omg
I'm using your code, and when I try to login I'm getting "Email or Password don't match" is not a valid rule error. Please help!
Remove 'is_unique[users.email]' from the $rules and try it again . It will work
I had the same error and was caused by the password field set to varchar(50). I change it to varchar(255) and solved the problem.
Alex your are a great instructor, Thanks a lot
👍👍👍👍👍
@@rarciniegas Thnaks Your comment solved my problem.
Alex first of all thanks for sharing such precious Knowledge with the world i am following your playlist of login registration and try to extend it bit by myself by involving forget password but i am having trouble in setting the cookies in ci4 here is bit sample code from my controller hope you get it
helper('cookie');
$this->response->set_cookie('forgetpwd',$token, time() + (3600),"/",site_url());
print_r($this->request->get_cookie('forgetpwd'));
die();
but it output blank
Hi, Kumar, thank for your kind words. Please upload your code to github so that i can analyze it.
And also why do you use a cookie for 'Forgot password' ? What do you try to achieve?
Thanks.
try using set_cookie(optione here) without $this->response->set_cookie()
thanks it works thanks a lot Alex please make some community where we can discuss all such issues so that all of us can contribute to your efforts in CodeIgniter 4 related issue and discussions related to it
@@kumarpal8837 Thanks for the suggestion. For now the focus is to establish the community on RUclips. So please suggest my channel to others or share a video on your channel. That would be a great support for me. Thanks!
email password dont match event with correct email and pass
Im getting error "Class 'CodeIgniter\Validation\UserRules' not found" please fast response
Download the source from the github (check description) and compare your code. You 've missed something
@@AlexLancer I am confused now. I will contact you immediately if this problem still cannot be resolved.
@@AlexLancer My mistake in "\App\Validation\UserRules::class", I am not check the path. Then the problem is when I type correct email and password look like in the database, it throw error "Email or Password don't match". I wish I could solve this small problem. Thank you for giving this great tutorial. Have a nice day :)
post your code on github please.
@@AlexLancer It has been resolved. It caused by bcrypt password. Is your code using auto bcrypt password for new user register? And
add them into database. All user in my database table haven't password yet. I was trying make new user password from phpmyadmin without encrypted and i got these mismatch. However now I have to bcrypt password then paste it to user table.
login with different passwords is working.
Apparently, I'm having the same issue. How did you fix it? Thank you in advance.
a great thank you to you for this help
You're welcome, Sandeep!
sir can we a create a single model file for multiple tables as old version
@@sandeepkumarr1212 watch this video's intro starting at 1:00 shorturl.at/ayT59
and then go to 50:30 of the same video to see how to make a CustomModel (similar to CI3)
Thanks for Your reply on the matter. Here is the git link github.com/stackpalk/Codeigniter4.git there is .sql file also on root .What i try to achieve is simple i try to implement forget pwd functionality on first screen i send mail by taking email id of user with newly generated token which is valid for 1 hour only that's why i need to set cookie in browser to compare it with the token that i send in email to proceed further similarly cookies can be used to remember me at login screen by setting token and encrypted credential for the next login automatically which is the next task i am going to implement.Plz configure email by your credential. Thanks for your efforts and time Alex
try using set_cookie(optione here) without $this->response->set_cookie()
You are my hero -_-)b
Not bad, but NOT good.
The biggest issue is that he doesn't explain ANYTHING he is doing, NOR WHY. It is like he is reading off of a script on another monitor, and already expects you to know the framework, keywords, methods, etc. It feels like he forgets that this is a Ci4 TUTORIAL, and NOT a HOW TO video. Or am I mistaken??
He also spends a LOT of time writing line after line of code without showing WHAT the code is actually doing as he writes it. Which is VERY difficult to learn by. One of the videos goes almost the entire length before testing it! A proper tutorial shows you progress every few minutes.
He also makes TONS of mistakes and typos, that are easily caught right away, and then have to fast forward through later when he goes back to fix them. That is easily the most frustrating part.
Bottom line - You really already need to be a PHP EXPERT, and FLUENT in Codeigniter 4 before watching this series. Otherwise you will be LOST. Too bad since not many RUclipsrs are covering Ci4 yet.
Friendly suggestion for you Sergio... Perhaps watch Alex’s series “CodeIgniter 4 from Scratch” first, then watch this series. You might feel differently about it then. I agree he makes typos, but he’s only human, we all do typos, and he shows how he spots them and corrects them, which is actually useful to a beginner.
Hey, Sergio, thanks for taking time to write the comment. I will take into consideration everything you say.
Hi Alex, I discovered something interesting. In your video you outputted errors to view by using $data['validation'] = $this->validator; that way the whole validation object gets passed to view with all the rules and stuff. It might be much leaner by passing just the error array by doing $data['errors'] = $this->validator->geterrors(); Then In the view you can traverse through $errors array of key value pairs.
Bartlomiej, glad that you keep learning. Yes you are totally correct.
The difference is that the errors I output are already with some predefined HTML, i believe as a UL->LI items. And actually you can create your own templates and then use it without foreach loop.
But I also tend to use the getErrors method.
Alex, great tutorial! I have tried to make validation in the model for my registration view do i need to create seperate model for my login view now since validation will change? How do I create custom validation rule in the model?
Thinking about it still I'm wondering do we have to validate login credentials at all? after all they are not being saved anywhere just read and compared. simple html5 validation could suffice on a front-end side of things imho.
You can not rely on frontend validation at any point. Only backend validation.
Now, the custom validation rule, can be just a simple method in your controller (or model) you don't need to make it a rule, as I showed in the tutorial, that was just an example, you can just create a method insider your file that will check that.
@@AlexLancer In that case would simple if else statement suffice? Like check if email and pass is there then if it is then if there is user with that email, compare pass if they match log in. anything else error? Looking at it ... it is what validation does anyways.
@@jigglypotatoes yes, thats exactly what i said to you in previous reply. You can add it wherever you like. No right or wrong.
@@AlexLancer Thank you sorry for repeating it twice like this. I would want to reach the stage when i will be more productive and confident with writing code. Some days I write one line and I try to figure out what to do next and how to. How long did it take you to reach your level of proficiency?
help! i have an error "Call to undefined function set_value() " everytime I login.
I guess you have not loaded the 'form' helper before using set_value()