Obtaining the users PW?
ddum
Joined: 2005-08-08
Posts: 37 |
![]() |
Hello! (Running a pretty current csv of G2 on Ubuntu 10.4) I am aparently missing the "Heureka-moment" when it comes to using the core classes. I am looking to code a simple web-form that will execute a few functions if the user/pass combo is that of an existing gallery user. I have found GalleryCoreApi.class, GalleryUtilities.Class and GalleryUser.class, but I cannot find any example on how I would do this. Any pointer? |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
GalleryCoreApi.class GalleryUser.class -s |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
example usage: list($ret, $user) = GalleryCoreApi::fetchUserByUserName('plain_text_username'); if ($ret) { print "Error fetching user:".$ret->getAsHtml(); exit; } if($user->isCorrectPassword('plain_text_password')){ echo "hurray"; }else{ echo "wrong"; }
-s |
|
ddum
Joined: 2005-08-08
Posts: 37 |
![]() |
Thanks... But now quite right aparently(?) Fatal error: Call to a member function search() on a non-object in /var/www/clients/client1/web13/web/gallery2/modules/core/classes/helpers/GalleryUserHelper_medium.class on line 137 <?php list($ret, $user) = GalleryCoreApi::fetchUserByUserName('janjoh'); ?> |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
<?php /* Connect to gallery */ function init() { require_once ('/full/system/path/to/gallery2/embed.php'); $ret = GalleryEmbed::init(array()); if ($ret) { print 'GalleryEmbed::init failed, here is the error message: '.$ret->getAsHtml(); exit; } GalleryEmbed::done(); } /* Check user password by username */ function checkuser($username, $password) { global $gallery; list($ret, $user) = GalleryCoreApi::fetchUserByUserName($username); if ($ret) { print "Error fetching user:".$ret->getAsHtml(); exit; } if($user->isCorrectPassword($password)){ return "hurray"; }else{ return "wrong"; } } init(); echo checkUser('plain_text_username', 'plain_text_password'); ?>
-s |
|
ddum
Joined: 2005-08-08
Posts: 37 |
![]() |
AHA! There was the Heureka-moment! I actually had not realized that I had to use the embed-functionality. I thought that was only for actually embedding 'visual' items. So, embedding is actually _all_ kinds of integration. Thanks! |
|
suprsidr
![]()
Joined: 2005-04-17
Posts: 8339 |
![]() |
You can find all the "Heureka" you want in my mediaBlock or my embed tool -s |
|