Hi,
Well i tried to create a password with the function you gave, it creates the password and the database is updated as well but it does not allow me to log in:S. The strange thing is that it allows me to log in with the default admin/admin username/password, whereas no such user with that password exists in the database. Any idea? Any help would be highly appreciated. Thank you.
Regards
beckett
Joined: 2002-08-16
Posts: 3474
Posted: Tue, 2008-03-25 03:39
Did you clear the db cache after updating the database?
Posts: 32509
i suggest you use g2's api:
- to create users:
from modules/core/AdminCreateUser.inc
list ($ret, $user) = GalleryCoreApi::newFactoryInstance('GalleryEntity', 'GalleryUser'); if ($ret) { return array($ret, null); } if (!isset($user)) { return array(GalleryCoreApi::error(ERROR_MISSING_OBJECT), null); } $ret = $user->create($form['userName']); if ($ret) { if (!($ret->getErrorCode() & ERROR_COLLISION)) { return array($ret, null); } /* Set our error status and fall back to the view */ $error[] = 'form[error][userName][exists]'; } else { $user->setEmail($form['email']); $user->setFullName($form['fullName']); $user->setLanguage($form['language']); GalleryUtilities::unsanitizeInputValues($form['password1'], false); $user->changePassword($form['password1']); $ret = $user->save(); if ($ret) { return array($ret, null); }- to change passwords:
$user->changePassword($form['password1']); $ret = $user->save(); if ($ret) { return array($ret, null); }- to learn more about the password hash algorithm:
modules/core/classes/GalleryUser.class function changePassword()
--------------
Doumentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage
Posts: 5
Is there not a simpler way to convert a string like "bill" into a usable password for Gallery2?
For phpbb I simply converted using MD5(), but gallery2 is a modified version of it.
If I reset their password through the Admin page of Gallery2,
then I can recreate a useable one with the following code:
I've already loaded all the other information, but this seems to be the hang up.
Thanks for you help!
Posts: 32509
i guess that's a copy from GalleryUtilities, right?
to create the hashes password, use:
1.
require_once('modules/core/classes/GalleryUtilities.class');
print GalleryUtilities::md5Salt($password);
2. set g2_User.g_hashedPassword (database) to the resulting value.
3. clear the db cache:
FAQ: How can I clear cached data?
Posts: 5
Yes, I copied that from GalleryUtilities.
That is great help - thanks so much!
Posts: 5
Worked perfect - Thanks!
Posts: 1
Hi,
Well i tried to create a password with the function you gave, it creates the password and the database is updated as well but it does not allow me to log in:S. The strange thing is that it allows me to log in with the default admin/admin username/password, whereas no such user with that password exists in the database. Any idea? Any help would be highly appreciated. Thank you.
Regards
Posts: 3474
Did you clear the db cache after updating the database?
-Beckett
--
(gratuitous link to my gallery! ~~ http://photos.beckettmw.com/ )