Basic Guide to Myth:Auth - CodeIgniter4

  Рет қаралды 6,798

Rohan Tejeswar

Rohan Tejeswar

Күн бұрын

Пікірлер: 31
@RohanTej
@RohanTej 3 жыл бұрын
As mentioned in the disclaimer, I didn't know what I was doing and I still don't know it. I've moved on from CodeIgniter and PHP as a whole so I couldn't be bothered to revisit and learn what you're actually supposed to do. So I'll add this to the pinned comment so new visitors to this video try to use this video to understand how to set it up but don't use this as something written in stone. So - - vendor is a directory where you install 3rd party dependencies. This folder is supposed to be untouched. When you share your code base with someone else as part of a git repo this folder will be in .gitignore and hence other people working on your code base will have to run `composer update` to download the dependencies locally for them. What all of that means is that you SHOULD NOT edit the code written in any of the files within the vendor subdirectory. You can read more about it from profesionals here - getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md So what should you do instead? My recommendation would be to do your own research on how to do it properly. Google or an experienced friend/colleague would be a good resource. If neither of those resources work, I would recommend going for the manual installation route as mentioned on their github page here - github.com/lonnieezell/myth-auth#manual-installation
@Jverse
@Jverse 2 жыл бұрын
Your voice is good man 👌 Make more tech related videos this way.
@kukuhprayuda
@kukuhprayuda 3 жыл бұрын
why im always getting this email while trying to registrate tho i have already filled in it 'The username field is required'
@thisismehrab
@thisismehrab 4 жыл бұрын
Useful content, Thanks 👍🏽
@kennethkipchumba2532
@kennethkipchumba2532 3 жыл бұрын
Much appreciated. Build more of CI stuff.
@robiandri688
@robiandri688 4 жыл бұрын
how to register for another account without going through the register menu that has been created, only the admin can register with a certain groups, there are difficulties in this case applying your algorithm in my project.
@RohanTej
@RohanTej 4 жыл бұрын
I had to use this myself a while ago and I wrote the code for it like this - pastebin.com/T0DWt5C8 $credentials is an array which looks like this : $creadentials = [ 'username' => 'abc', 'password' => 'abc' ]; and $email is a string for email address. This is not a good piece of code and it can be improved. I recommend you check myth-auth's App\Controllers\AuthController.php::attemptRegister() method to learn more about how the vanilla register works and see if you are able to imporve the code.
@robiandri688
@robiandri688 4 жыл бұрын
@@RohanTej for me that to complicated, i just need how u hash the password algorithm, i read your code over and over but i still didnt get it.
@RohanTej
@RohanTej 4 жыл бұрын
@@robiandri688 I can explain how the function works because all that method does is make a password hash and save it in the database. From Line 25 till Line 41 sets up hashing options. You don't need to know how that works. Just copy-paste that code. Line 42 creates the hashed password. '$password' variable is your plain text password which will be hashed. You can do whatever you wish to do with $password_hash. My method does additional checks such as making sure if the user already exists or not and stuff like that. If that is something you want to impliment in your code, you can copy this entire method and pass the arguments like I previously mentioned and it will work out of the box.
@robiandri688
@robiandri688 4 жыл бұрын
@@RohanTej $user = new UserModel(); This line i dont understand, and this still error, my controller extend from basecontroller, so how i fix this error ?
@RohanTej
@RohanTej 4 жыл бұрын
@@robiandri688 Did you migrate your models?
@angelotamarones7736
@angelotamarones7736 3 жыл бұрын
thanks for the tutorial but its shows This page isn’t working localhost redirected you too many times.
@sosepi
@sosepi 3 жыл бұрын
Could you please share the SQL schema please
@FueguinoTdF
@FueguinoTdF 4 жыл бұрын
when i create a user it doesn't save the password and username in the database. just save the record with the email.
@RohanTej
@RohanTej 4 жыл бұрын
Are you using custom views or custom code to insert the record to the database?
@FueguinoTdF
@FueguinoTdF 4 жыл бұрын
@@RohanTej no, I followed the steps in the video, I am using the default view.
@RohanTej
@RohanTej 4 жыл бұрын
@@FueguinoTdF that's weird. Not much I can do to help you with that. Can you try rolling back and redo the process? Maybe you made a mistake somewhere. If that doesn't help, I'd recommend raising an issue on stackoverflow where you can post your code and such
@parkhyungseok2841
@parkhyungseok2841 4 жыл бұрын
How to change password_hash in table users with password_verify ()?why password_verify always return false
@RohanTej
@RohanTej 4 жыл бұрын
I am not entirly sure what you mean. But if you want to update the password in the database, then I'd recommend you take a look at App\Controllers\AuthController.php file's attemptReset method to understand how it works. password_verify() is supposed to match the first string which is the user input hashed password with the one in the database. It would return false if they do not match.
@parkhyungseok2841
@parkhyungseok2841 4 жыл бұрын
password_InDbs = user()->password_hash; $passwordNow = $this->request->getPost('password_now'); if (password_verify($passwordNow, $password_InDbs)) { echo "success"; } else { echo 'failed'; } *why result always failed? I have entered the correct password but the result is always failed. please help me 🙏
@RohanTej
@RohanTej 4 жыл бұрын
@@parkhyungseok2841 I am not sure why are you doing it this way. You can use the existing methods as I've mentioned in the video to verify user. If you are trying to figure this out I'd highly recomend you give correct way a shot first. But if you insist on doing it your way, this is how you're supposed to do it. $result = password_verify(base64_encode( hash('sha384', $passwordNow, true)), $user->password_hash);
@parkhyungseok2841
@parkhyungseok2841 4 жыл бұрын
Thks you very much , that is work 🙏
@syahisromirajdandi682
@syahisromirajdandi682 4 жыл бұрын
How to make CRUD data user?
@zainimuhaimin8481
@zainimuhaimin8481 3 жыл бұрын
thanks you just help me.
@agokmen1834
@agokmen1834 2 жыл бұрын
I went blind 480p
@RohanTej
@RohanTej 2 жыл бұрын
Sorry about that. Not sure what happened. I originally uploaded it in 1400x900, HD enough that you could clearly read the text. Somehow youtube made it SD.
Codeigniter 4 - Authentication with Ion Auth
15:19
TIL things
Рет қаралды 10 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
99.9% IMPOSSIBLE
00:24
STORROR
Рет қаралды 31 МЛН
Don't Use Websockets (Until You Try This…)
6:46
Code With Ryan
Рет қаралды 327 М.
CodeIgniter Shield Installation and Overview
15:55
IgnitedCode
Рет қаралды 13 М.
Now is The Best Time to Learn React Native
7:05
Awesome
Рет қаралды 45 М.
Interview with a Senior Python Developer - Part1
4:57
Programmers are also human
Рет қаралды 852 М.
Dirty D3.js Part 1: D3 is not what you think
8:55
Fun Fun Function
Рет қаралды 10 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН