Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#553 2008-04-04 18:57:45

typeshige
Member
From: USA
Registered: 2005-08-11
Posts: 151
Website

Re: ign_password_protect

As a test this seems to work if placed at the top of the page:

<txp:ign_if_logged_in>
<txp:php>header(‘Location: ‘.hu);</txp:php>
</txp:ign_if_logged_in>

It even works when you go here to logout, oddly enough. I tried it out, but I expected it to redirect to the home page instead of logging out. Surprisingly, it logged out!

Is there anything wrong about doing it this way?

Thanks,
Shige

typeshige wrote:

At any time, if my questions seem like they’ve been covered already please let me know! I always try to do a basic search, but I think many of my questions have probably been asked by now… so please bear with me.

So, I made a section called “login” to display the login form. I can login and it’s dandy. I want to return to the home page if they’re logged in. What’s the best way to do that?

I saw this tag:

<txp:ign_if_logged_in><txp:else /></txp:ign_if_logged_in>

Is it possible to do a redirect if they’re logged in using that tag?

Thanks,
Shige

Offline

#554 2008-04-04 19:01:56

igner
Plugin Author
Registered: 2004-06-03
Posts: 337

Re: ign_password_protect

nothing wrong with it if it works. I wasn’t really sure if any output might have been sent to the browser at the point the if_logged_in tag is parsed, so I didn’t suggest the header approach, but since it works for you, that’s a great solution.


And then my dog ate my badger, and the love was lost.

Offline

#555 2008-04-04 22:16:26

typeshige
Member
From: USA
Registered: 2005-08-11
Posts: 151
Website

Re: ign_password_protect

Thank you very much for this. Your way seems to be much more standard, so I’ll keep this in mind to implement the second my approach breaks!

This is a great little plugin.

igner wrote:

Right now you could do a redirect with the if_logged_in logic by doing a meta-refresh – not 100% reliable, but it’s the best option at this juncture.1 So in the head of the login page, you’d have:

<txp:ign_if_logged_in><meta http-equiv="refresh" content="0;http://mysite/newsection/" /></txp:ign_if_logged_in>

That should do the trick – alternatively, set the refresh timeout to something a bit more reasonable – say 5-10 seconds, and for the body have something along the lines of:

<txp:ign_if_logged_in>
Put your success message here, and the redirect link so people can jump to the target page faster than the refresh time
<txp:else />
Put your login call here.
</txp:ign_if_logged_in>

Let me know if that makes sense.

1 I am (and have been for a while) planning on incorporating redirect functionality into the plugin at some point.

Offline

#556 2008-04-04 23:29:20

igner
Plugin Author
Registered: 2004-06-03
Posts: 337

Re: ign_password_protect

Actually, there’s nothing particularly non-standard about what you’re doing – it’s not all that far removed from what the plugin (eventually) will do, just at a slightly different stage.


And then my dog ate my badger, and the love was lost.

Offline

#557 2008-04-04 23:49:16

typeshige
Member
From: USA
Registered: 2005-08-11
Posts: 151
Website

Re: ign_password_protect

@igner: Thanks!

Oh, so if this thread wasn’t 56 pages already, I’d read it all to make sure it wasn’t answered. If it was, please point me to the right page.. :)

I have a rather large person database that I’d like this plugin to use. During initial setup, it asks if you want to use an external database and then creates one by copying the txp users over. Is there a way to just to tell it to use a table of my choice without trying to create/populate it? I will make sure the fields it wants are there manually.

I might be able to modify the plugin, but I wonder if this has already been solved…

Here is where I am so far: I got the plugin to work after figuring out that the .htaccess password protection wasn’t playing nice. Then I have the start of it working with the Vanilla Forum. So far, login and logoff work. There was a quirk where I had to add a line to the dhh_vanilla_integration v0.1 to make it work. Basically, it switches to the Vanilla database to complete the log off, but it confuses textpattern when it comes back because it can’t find tables vanilla.textpattern, for example. The solution that works for me was to perform a ‘use [your_txp_database]’ MySQL query before it exits the vanilla logoff function. Shrug.. seems to work and again, I’m not too confident that’s the best way to solve it.

Next: Experiment with the self-management features and see what modifications I need for my semi-closed structure and to see if that magically works with Vanilla..

Thanks again for the great plugin.

Offline

#558 2008-04-04 23:58:35

igner
Plugin Author
Registered: 2004-06-03
Posts: 337

Re: ign_password_protect

Right now the name of the alternate table is fixed / hard-coded, but with a little hackery you could set it to use another table. After install, there should be a value in txp_prefs table, for ign_user_db – just set the value of that to the table name you want to use.

Of course, the administration interface would likely need to be reworked to do any sort of management.

I look forward to hearing how things work out…


And then my dog ate my badger, and the love was lost.

Offline

#559 2008-04-05 01:10:14

typeshige
Member
From: USA
Registered: 2005-08-11
Posts: 151
Website

Re: ign_password_protect

@igner: Thanks! I’ll do what you suggest.

What does “Also authenticate against txp_users?” do? It seems to update the database, but I thought it would remain selected henceforth, but I’m able to keep selecting it and it updates something again.

Does it fall back to validating txp users if its not in the alternate user table?

I guess I thought there was a self register feature, but it doesn’t seem like there is one. Do you suggest mem_self_register as a starting point?

Thanks for your support, I’ll share my results as soon as have some.

Offline

#560 2008-04-05 04:40:42

igner
Plugin Author
Registered: 2004-06-03
Posts: 337

Re: ign_password_protect

Also authenticate against txp_users doesn’t do anything – it needs to be removed. The original intent was fallback authentication against txp_users. It’s been a while since I’ve looked at that chunk of code – I have no idea at this point if it works as advertised.

For self registration, use mem_self_register – I saw no reason to duplicate Manfre’s efforts, so we coordinated efforts to make the two plugins work together. If memory serves, it respects the ign_user_db pref, so you should be all set.

Edit: Reviewed the code and realized that the fallback code is still in place. I’ll need to revisit that and ensure it’s doing what it’s supposed to, or at least doing something.

Last edited by igner (2008-04-05 05:00:01)


And then my dog ate my badger, and the love was lost.

Offline

#561 2008-04-05 16:11:56

sanmarco
Member
From: austria
Registered: 2007-03-22
Posts: 31
Website

Re: ign_password_protect

hi, at first, great plugin!

just one thing, when I use messy urls than it leads always back to the first page instead into the content of the page/section where the login is placed. Is there any soloution? Or may i missed something the last 30 pages here (I worked through he frst 20 pages but dont found anything.

sanmarco

Offline

#562 2008-04-06 04:55:51

igner
Plugin Author
Registered: 2004-06-03
Posts: 337

Re: ign_password_protect

Hmm, I could have sworn I’d addressed the messy URL issue…never mind, it was a different issue.

well, this version addresses the logout path under messyu urls… ign_password_protect.0.5b8


And then my dog ate my badger, and the love was lost.

Offline

#563 2008-04-06 07:28:26

sanmarco
Member
From: austria
Registered: 2007-03-22
Posts: 31
Website

Re: ign_password_protect

thanks for the reply. I just downloaded the 0.5b8 version and installed it but unfortunitly still than when I login it leads back to the main page or so called default section.

Offline

#564 2008-04-06 07:29:37

sanmarco
Member
From: austria
Registered: 2007-03-22
Posts: 31
Website

Re: ign_password_protect

..i forgot. Do I may need somthing ajust in the plugin script? I checked it out but dont found anything I have to change may.

Offline

Board footer

Powered by FluxBB