External Log-in

Exousia

Joined: 2005-04-06
Posts: 8
Posted: Wed, 2005-04-06 10:12

Hello,

I recently installed G2 and I have to say , bravo ;-)

The only thing is, i should like to have an external log-in for my G2 gallery so that people can log-in trough my homepage.. it's because my site is very private... i don't want to have 2 separate logins on my website

Could anybody help me plz ?

Thx a lot !

greetz

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-04-06 11:10

take a look at docs/EMBEDDING and click on the link in my signature (Embedding & Integration). please take your time reading the extisting questions/answers concerning embedding and feel free to ask further questions.

 
Exousia

Joined: 2005-04-06
Posts: 8
Posted: Wed, 2005-04-06 11:24

okay , i've checked them all , but there'll all to big , for me it just has to be a simple log-in screen and when you log-in here , you will redirect to my gallery and be logged in .. according to me it's very simple but I'm not that big php freak ;-)

thx

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-04-06 12:12

no, it's not that simple and you will have to use embed.php.

here's why...
- you want that the user has to login only once.
- this implicates that the user exists in both applications, in your websites user management as well as in G2.
- therefore you need to synchronize create user events from your website to G2.

Quote:
it just has to be a simple log-in screen and when you log-in here , you will redirect to my gallery and be logged in .. according to me it's very simple

this part of embed.php is also very simple. either call GalleryEmbed::login and you will be logged in automatically or pass all request to G2 through a wrapper which calls GalleryEmbed::init and GalleryEMbed::handlerequest.

it's explained all over the forum. please, take your time reading these posts.

 
Exousia

Joined: 2005-04-06
Posts: 8
Posted: Thu, 2005-04-07 14:59

<form method="post" action="http://...... ">
Naam : <input type="text" name="username" class="inputfield" /><br>
Paswoord : <input type="password" name="password" maxlength="32" class="inputfield"/>
<input type="submit" name="login" value="Login"/>
</form>

Something like this won't work ? Instead of the http:// a g2 url of course ?

I don't really understand the embed.php :s i'm sorry

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-04-07 15:03

all you would achieve with such a login box is that the user is logged in in G2. I thought you already have a login box for your homepage. which would mean that you already have a user and session management in your homepage.
what you propose is a solution where the visitors of your website have to login twice. first for your homepage, then for G2.

 
Exousia

Joined: 2005-04-06
Posts: 8
Posted: Thu, 2005-04-07 15:05

okaaayyy ,

It's the first one you told you know , it's a site for my friend , the site only contains his gallery, i only want to achieve that you are logged in in G2 ...

how should my form look like then ?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-04-07 15:13

just copy the html of the login box of G2 to your own website.

<div class="gbBlock">
<form id="LoginSystemContent" action="http://192.168.123.123/gallery2/main.php" method="post"><div>
  <input type="hidden" name="g2_returnName" value="album"/>
<input type="hidden" name="g2_return" value="http://192.168.123.123/gallery2/main.php"/>
<input type="hidden" name="g2_formUrl" value="http://192.168.123.123/gallery2/main.php"/>

  <input type="hidden" name="g2_controller" value="core:UserLogin" />
  <input type="hidden" name="g2_form[formName]" value="UserLogin" />

  <input type="text" id="giFormUsername" size="10"
   name="g2_form[username]" value="Username"
   onfocus="var f=document.getElementById('giFormUsername'); if (f.value == 'Username') { f.value = '' }"
   onblur="var f=document.getElementById('giFormUsername'); if (f.value == '') { f.value = 'Username' }"
   />

  <br/>

  <input type="password" id="giFormPassword" size="10" name="g2_form[password]"/>
  <input type="submit" class="inputTypeSubmit"
   name="g2_form[action][login]" value="Login"/>
</div></form>
</div>  

replace all "http://192.168.123.123/gallery2/" by your url and add/replace all css/javascript as needed.

 
Exousia

Joined: 2005-04-06
Posts: 8
Posted: Thu, 2005-04-07 15:16

thank you a lot !!!

 
aaronbrockhurst

Joined: 2003-11-25
Posts: 35
Posted: Mon, 2007-04-09 23:12

Hi

I tried using this code with the latest version 2.2.1 but have found that if the user doesn't "logout", ie the move away or just close the browser when they log back in again it generates a 404 page which if you refresh takes them into gallery

Has anyone experienced anything similar?

Is this due to a change in the G2 security?

Is there a way to reset the login cookies?

Aaron

 
Slayergirl
Slayergirl's picture

Joined: 2007-09-12
Posts: 180
Posted: Thu, 2007-10-18 08:30

I have the same thing as Aaron wenn people just move away without logging out and then enter through the form again. Well it's not a 404 but this message "Authentication Failure

Your change cannot be completed due to a loss of session data. Please try again. If it still doesn't work, try logging out and logging back in.

Back to the Gallery"

Error (ERROR_REQUEST_FORGED)
in modules/core/classes/GalleryController.class at line 239 (GalleryCoreApi::error)
in main.php at line 224 (GalleryController::assertIsGenuineRequest)
in main.php at line 94
in main.php at line 83
in main.php at line 3

Is there anyway to prevent this from happening if a user is logged in already?

Gallery version is 2.2.3

I have read this: http://gallery.menalto.com/node/63118 but the server where the login-form is, is a not a PHP-server.