Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#193 2006-04-02 13:52:51

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: ign_password_protect

igner,

I’m using 0.4.2c. I’ve just tried your trick with the ‘nonce’ field and it now allows me to login properly. I’ve always wondered what that ‘nonce’ field is for – I’ve seen it in the zem_contact plugin as well.

Interestingly enough, on the extensions > ign_user_mgmt page I can’t get the ‘Use alternate database’ setting to stick to ‘Yes’. It always drops back to ‘No’ but the login function seems to keep working happily. I guess if it works I shouldn’t ask too many questions

Offline

#194 2006-04-02 14:47:51

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

Re: ign_password_protect

The nonce is just checksum of sorts. There’s an old legacy check in there from the code I lifted from the core that updates the database if the nonce is empty.

If it’s not working as advertised, by all means ask questions. Heck, I might be moved to issue refunds. Here’s yours. :)

Seriously though, feedback is critical to addressing issues. Ask away.


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

Offline

#195 2006-04-02 22:23:49

snkhan
Member
From: Leicester, UK.
Registered: 2004-07-20
Posts: 57
Website

Re: ign_password_protect

Hi matey,

My current TP install is not located at the domain root, it is offset to a /journal/ directory. Anyway, a couple of questions:

1) Is it possible to display a log out link without displaying the user’s name? For instance modifying it such that “<txp:ign_logged_user text=“Log out” />” .

2) On a offset install (described above), clicking on the log out link takes you to the domain root, appending the URL with “?logout=1”. This however, does not log one out, as the logout URL should read journal/<section>?logout=1

Great work with the plugin, it seems to be working brilliantly. Although I have only just skimmed over the possibilities, has anyone managed to password protect just one section? And are files uploaded to certain sections still ‘protected’ ?

Thanks,

Saj

Offline

#196 2006-04-03 13:00:31

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

Re: ign_password_protect

<quote>My current TP install is not located at the domain root, it is offset to a /journal/ directory. Anyway, a couple of questions:

1) Is it possible to display a log out link without displaying the user’s name? For instance modifying it such that “<txp:ign_logged_user text=“Log out” />” .

2) On a offset install (described above), clicking on the log out link takes you to the domain root, appending the URL with “?logout=1”. This however, does not log one out, as the logout URL should read journal/<section>?logout=1
</quote>

Both of these are possible by editing one section of the plugin. In the ign_logged_user function, find the lines that read:
<code> if ( !$ign_err ) { list($c_userid,$c_privs,$c_realname,$cookie_hash) = split(‘,’,$_COOKIE[‘ign_login’]); $u_display = (strtolower($display) == ‘realname’) ? $c_realname : $c_userid; $user= ($verbose) ? graf(gTxt(‘logged_in_as’).’ ‘.$u_display.br.’<a href=”?logout=1” alt=”’.$alt.’” title=”’.$alt.’”>’.gTxt(‘logout’).’</a>’) : ‘<a href=”?logout=1” alt=”’.$alt.’” title=”’.$alt.’”>’.$u_display.’</a>’; return $user; } else { return graf($logged_msg); }
</code>

and change to

<code> if ( !$ign_err ) { return “<a href=’”.$_SERVER[‘REQUEST_URI’].”?logout=1’>Log Out</a>”; } else { return graf($logged_msg); }
</code>

(Caveat: it’s early, I haven’t had my coffee, and I didn’t test the above code. Nevertheless, it should do what you are looking for.)

<quote>
Great work with the plugin, it seems to be working brilliantly. Although I have only just skimmed over the possibilities, has anyone managed to password protect just one section? And are files uploaded to certain sections still ‘protected’ ?
</quote>

You can easily protect one section if it uses a unique page template by adding the tag to the page. As far as the files go – the plugin’s really designed to protect inline content only. It does not prevent content from being accessible in searches or RSS feeds.


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

Offline

#197 2006-04-03 17:48:57

snkhan
Member
From: Leicester, UK.
Registered: 2004-07-20
Posts: 57
Website

Re: ign_password_protect

Thanks for your response Igner. I am currently getting the following error based on the following code amendment:

<code>
//———————————————————————- //displays logged-in user function ign_logged_user($atts) { global $ign_user, $ign_err;

extract(lAtts(array( ‘logged_msg’ => IGN_NOT_LOGGED_IN, ‘display’ => ‘name’, ‘alt’ => IGN_LOGOUT_LINK, ‘verbose’ => false, ‘greeting’ => gtxt(‘logged_in_as’) ), $atts));

if ( !$ign_err ) {
return “<a href=’”.$_SERVER[‘REQUEST_URI’].”?logout=1’>Log Out</a>”;
} else {
return graf($logged_msg);
}
}
</code>

The error being returned (on most admin pages)

<code>
Parse error: syntax error, unexpected $end in /usr/local/psa/home/vhosts/thekhans.me.uk/httpdocs/journal/textpattern/lib/txplib_misc.php(459) : eval()’d code on line 1109
The above errors were caused by the plugin:ign_password_protect
</code>

Offline

#198 2006-04-03 18:34:59

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

Re: ign_password_protect

Saj,
line 1109 is toward the bottom of the plugin, the lines you edited are toward the top.

I tested the code copied and pasted from your post, and it’s working fine for me. I’m betting there’s a stray character in there somewhere else. Try reverting back to an unmodified version, and re-applying the hack, and let me know if that doesn’t solve the problem.


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

Offline

#199 2006-04-08 03:48:54

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: ign_password_protect

I can’t seem to be able to use login_type of anything but browser (which I don’t want because that doesn’t work if you’re not using mod_php). The help says the default is inline, and you can also set it directly to be inline. No matter what, I still get the browser prompt. Am I being daft or what?

Offline

#200 2006-04-08 04:58:38

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

Re: ign_password_protect

Mary, are you really sure you’re qualified to be using plugins? Code samples help ;)

How are you using the tag? Are you using it in the self-closing form? <txp:ign_password_protect /> will ALWAYS trigger browser-based authentication.

Use <txp:ign_password_protect></txp:ign_password_protect> instead. (Or use <txp:ign_if_logged_in></txp:ign_if_logged_in> in conjunction with <txp:ign_show_login /> to separate the authentication form and the actual protected content)


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

Offline

#201 2006-04-08 05:52:24

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: ign_password_protect

Mary, are you really sure you’re qualified to be using plugins? Code samples help ;)

Shaddap. ;p I’ve earned posting vague help requests. :D

Are you using it in the self-closing form?

Aha, yes that’d be the problem. Thanks muchly, now all is well. :)

Offline

#202 2006-05-05 14:34:39

Mike Montgomery
Member
Registered: 2005-11-28
Posts: 29
Website

Re: ign_password_protect

I have successfully used ign_password_protect version 0.4.2 on a site for a long time (and it works great!)

Today, I downloaded version 0.4.2c for another site. In an article form called “password” (natch!), I added this:

<code><txp:ign_password_protect login_msg=“Please login to view this page” remember=“true”> <h2><txp:permlink><txp:title /></txp:permlink></h2> <txp:body />
</txp:ign_password_protect></code>

and then set one of the articles to “override form” and use the form “password”.
Now, the whole site continues to work, but when I click on the link to read that article, I get this error:

Parse error: syntax error, unexpected T_STRING in <code>[server address stuff]/textpattern/publish.php(934)</code> : eval()’d code on line 203

What am I doing wrong?

Last edited by Mike Montgomery (2006-05-05 14:40:47)

Offline

#203 2006-05-05 16:41:25

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

Re: ign_password_protect

Don’t look at me, I just wrote the thing. I have no idea how it works.

Seriously, though, I just tested using your code above1, and seems to work fine for me. If you want to shoot me link info offlist, I can take a look at it2.

1 copied from the source. To get code to show up in the forums, wrap the code in < code > tags, or use pastebin.

2 All support work is billed at USD$12,000/hr. with a 3-hour minimum. But all service comes with a money-back guarantee3, and I offer generous payment terms of Net 25,550 days.

3 I guarantee you’ll want your money back, not that you’ll actually get it.


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

Offline

#204 2006-05-17 10:05:58

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 548

Re: ign_password_protect

Hi this seems like a really good plug-in, just what I need for me site. I’m having some trouble getting it to work though. I’m using the following code in a page template as a test:

<code>
<txp:ign_password_protect login_msg=“Please log in to view this resource”>
<h1>Password Protected Stuff</h1>
Hello world! Do you know where your towel is?
</txp:ign_password_protect>
</code>

When ever I visit the page (before logging in) it displays the following message: ‘Sorry, the username and/or password entered is not valid, or you do not have privileges to access this resource’ and displays the login form. Whenever I try to login with my username and password (which I setup in the Textpattern admin tab) it loops back around to the login form and displays the same error message again.

Am I doing something wrong? I’m trying different tags and options but keep getting the same results.

Thanks for any help.

Last edited by Algaris (2006-05-17 10:06:12)

Online

Board footer

Powered by FluxBB