Hooking login and profile editing

ghostks

Joined: 2006-04-20
Posts: 1
Posted: Thu, 2006-04-20 19:40

Hi all, I'm trying to embed gallery2 (g2 rule! thx to developers)into PHP-Fusion and everything is going fine except for two moments. All embeding is working (session management and user creation/updating), but I can't to hook some events:
* login action, I want that users to be redirect to my login page instead of g2.login. 'loginRedirect' parametr in GalleryEmbed::init do nothing about that, I mean it's doesn't matter what I'm writing there and g2 is showing his login page. How could I change this to redirect to my preffered page?
* after user is successfully logged in he could change his information, how can I track this? (for ex. pass changing, if user will change pass there it will be different from my CMS user's DB)

 
geddes

Joined: 2006-05-31
Posts: 7
Posted: Thu, 2006-06-01 18:34

I realize this post was made in April, but I am having a similar problem, so i thought I'd bump this one. Setting a loginRedirect in the init function doesn't seem to be working for me either, the login link still goes to the Gallery login system and not to the page I tell it to.

My other (related) question: Is there a way to turn on the login/logout link but turn off the "my account" link?
I am not embedding gallery into a CMS, but just integrating it with an exhisting radius sysem for authentication. The reason I have GalleryCapabilities::set('login',true) is because I want the users to be able to log out from the system. However, I don't want them to be able to edit their account, because, for one thing I'm not storing passwords in the gallery DB. The wrapper handles all the authentication. Even if they were to change their password in the gallery system, it wouldn't actually change it since the wrapper/entrypoint will authenticate their username against the radius server anyway.

Any advice would be appreciated, here is the relevent part of my wrapper:

 $ret = GalleryEmbed::init(array('embedUri' => $embedUri, 'g2Uri' => $g2Uri, 'activeUserId' => $h_user, 'loginRedirect' => $h_loginPage));
 GalleryCapabilities::set('login', true);
 if ($ret) {
     /* Error! */
     /* Did we get an error because the user doesn't exist in g2 yet? */
     $ret2 = GalleryEmbed::isExternalIdMapped($h_user, 'GalleryUser');
     if ($ret2 && $ret2->getErrorCode='ERROR_MISSING_OBJECT') {
         /* The user does not exist in G2 yet. Create in now on-the-fly */
         $ret = GalleryEmbed::createUser($h_user, array('username' => $h_user));
         if ($ret) {
             /* An error during user creation. Not good, print an error or do whatever is appropriate 
              * in your emApp when an error occurs */
             print "An error occurred during the on-the-fly user creation <br>";
             print $ret->getAsHtml();
             exit;
         }
         $ret3 = GalleryEmbed::login($h_user);
         if ($ret3)
         	{
             /* An error during user login. Not good, print an error or do whatever is appropriate 
              * in your emApp when an error occurs */
             print "An error occurred during the on-the-fly user creation <br>";
             print $ret->getAsHtml();
             exit;
         	}
     } else {
         /* The error we got wasn't due to a missing user, it was a real error */
         if ($ret2) {
             print "An error occurred while checking if a user already exists<br>";
             print $ret2->getAsHtml();
         }
         print "An error occurred while trying to initialize G2<br>";
         print $ret->getAsHtml();
         exit;
     }
 }
 /* At this point we know that either the user either existed already before or that it was just created
  * proceed with the normal request to G2 */
 $g2moddata = GalleryEmbed::handleRequest();
 
geddes

Joined: 2006-05-31
Posts: 7
Posted: Thu, 2006-06-08 18:55

I would like to bump this one more time before I give up. I don't understand why this isn't working. It is the last piece of the puzzle before my Gallery is complete:

$h_loginPage='/gallery-entry/login.php';

...

 $ret = GalleryEmbed::init(array('embedUri' => $embedUri, 'g2Uri' => $g2Uri, 'activeUserId' => $h_user, 'loginRedirect' => $h_loginPage));

...

 $ret4 =GalleryCapabilities::set('login', true);


I want to have the login link available, I just want it to go to my custom login page, not to gallery's login page, since that one won't work with my custom authentication function. However, as the code is currently written, the login link goes directly to Gallery's own login form. I can't figure this one out for the life of me. :-(

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2006-06-10 09:44

yes it's broken. will look into it.
thanks for the notice.

 
stounedi

Joined: 2005-09-26
Posts: 15
Posted: Mon, 2006-08-28 09:47

So... Did you ever get it to work with php-fusion? I would really love to hear if you did, because I am now trying to embed it too...

 
tryme83

Joined: 2006-10-14
Posts: 2
Posted: Mon, 2006-10-30 23:25

Me too! Please post the code!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2006-10-31 23:20

loginRedirect has been fixed in G2.2.
In G2.1.2, loginRedirect only influenced the redirect if a user had insufficient view permissions. Now it redirects all requests for the UserLogin view.

 
wijkkie

Joined: 2005-08-03
Posts: 78
Posted: Wed, 2007-01-03 23:22

Has someone get it working already? I would like to embed it too to my phpfusion!

Already my thanks for helping!

 
stounedi

Joined: 2005-09-26
Posts: 15
Posted: Thu, 2007-08-02 01:08

Hey... Is there any chance you would like to share the embed-code with us? I would love to embed Gallery2 into my php-fusion site but unfortunately I dont have any idea how to do it...

 
stounedi

Joined: 2005-09-26
Posts: 15
Posted: Sun, 2007-11-11 18:51

Still no luck embedding Gallery2 into php-fusion?

 
stounedi

Joined: 2005-09-26
Posts: 15
Posted: Tue, 2008-01-29 09:01

I am still looking for a solution to embed gallery2 into php-fusion :(

Too bad I dont have good enough skills with php...

 
VoiceX

Joined: 2005-09-26
Posts: 12
Posted: Sat, 2008-03-29 12:10

please help us with the integration into phpfusion!

-------------------------------------
GreetX from Switzerland

VoiceX