Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user with password as MD5 hash #14

Open
garduino opened this issue Apr 16, 2018 · 4 comments
Open

Add user with password as MD5 hash #14

garduino opened this issue Apr 16, 2018 · 4 comments

Comments

@garduino
Copy link

With the example for the user's CRUD, GC always store the password in clear text, even when have the MD5 configured.

How to store the hash instead the clear text password?

@portapipe
Copy link
Owner

Hi,
the code provide a way to encrypt the password for the login check.
The database insert is managed by you.
I've added an example to the wiki on how to manage md5 password creation:
https://github.com/portapipe/Login-GroceryCrud/wiki/Manage-the-users

Test it and let me know :)

@garduino
Copy link
Author

garduino commented Apr 16, 2018

Hi! and thanks you very much for your quick answer!

I was trying some sort of "hardcoding" assuming that always I will use MD5, at this way:

$crud->callback_before_insert(md5('password'));

but not worked.

Your suggestion is not working neither for me, may be because I do not have the users() function inside the Login controller, should be there?

Note: I also tried to move the users() function inside the Login.php controller and also the passwords are stored as clear text.

Also I do not understand the function encrypt_password_callback() and where it should be pasted.

I'm sorry, I'm still newbie with CI, GC et all and need to learn :)

@portapipe
Copy link
Owner

$crud->callback_before_insert(md5('password'));

You have to follow this documentation strictly:

https://www.grocerycrud.com/documentation/options_functions/callback_before_insert

@garduino
Copy link
Author

garduino commented May 7, 2018

Thanks for your answer.

I think that in https://github.com/portapipe/Login-GroceryCrud/wiki/Manage-the-users

were says:

If you need to use MD5 encryption, add this just above the $output row:

$crud->callback_before_insert(array($this,'use_md5_password'));

shoud says:

If you need to use MD5 encryption, add this just above the $output row:

$crud->callback_before_insert(array($this,'encrypt_password_callback'));

At this way it seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants