Is there a way to enter a password every time you go to the node?
Right now the browser saves your data and you don't need to enter the password again until you delete history/cache, or reset in the modules settings.

What if someone accessed this on a public computer and did not know he/she has to clear browsing data.

I need something that either automatically protects the node again once you leave the page or a log out button that appears on the page you access so the page can be "secure" again.

Any help would be appreciated, thanks.

Comments

AlexisWilke’s picture

Category: feature » support

The Rules extension offers a "node lock" action that allows you to clear the $_SESSION used with a given page.

There is no such automatism by default. You could also reduce the amount of time the password is live for to a small amount (i.e. 5 minutes) which would most certainly work the same way unless the user hits reload every few minutes.

Thank you.
Alexis Wilke

AlexisWilke’s picture

Title: logout? » protected node auto-logout when leaving a protected node?

Fixed title to be more talkative.

cathyhutzler’s picture

I need a solution to this as well. I have installed rules module and Protected Node rules extension. After searching on drupal.org and the internet I am not sure what to do next. Using drupal 6.25 If it is not too much trouble. Can you provide detailed information on how to add a node lock or inform me how to reduce the time the password is live. Your help is much appreciated.

AlexisWilke’s picture

I'm sorry... actually there isn't a way to setup the time to live of a protected node session. I guess that would be a neat addition. (in regard to my 5min. comment in #1)

Anyway, I added documentation about the Protected Node Rules and included a paragraph to give an example for how to do this. Unfortunately, you cannot use Rules with CRON to cancel a user session...

Let me know whether that works for you.

Thank you.
Alexis Wilke

cathyhutzler’s picture

Thank you for the quick response. I was able to set this up and get this working on my site.

AlexisWilke’s picture

Status: Active » Fixed

Okay, I guess I'll mark this as fixed then.

Thank you for the feedback.
Alexis

cathyhutzler’s picture

StatusFileSize
new30.83 KB

Ok I thought I got this fixed, but when I tested it again today it does not work. Sigh
Here is what I did.
I created a thank you page and added a sticky to it.
On the page that is protected I added a log out button that links to this page.
I then created a rule
triggered rules/add a new rule/ created a name
and chose
Event: Content is going to be viewed
I checked: This rule is active and should be evaluated when the associated event occurs.
I then added a conditional that the page is sticky (this is so the event happens on logout and not after the password is entered on the protected page)
Next I added the action "lock the node away from the current user"

I have my page cache disabled.
Is there some thing I am missing?

AlexisWilke’s picture

You're missing the loading of the node you want to lock. At this point you're "locking" the thank you page.

In the action you first need to "Load content by id" and use the id of the node you're leaving.

Thank you.
Alexis

cathyhutzler’s picture

Thank you for your help. I really appreciate it. I know I must be over thinking it but I am also a newbie to using rules so thank you for hanging in here with me.
When you add the Load by content id do you just enter the node number in the Content ID field? I have tried just 1198, node/1198 and even the token [node:nid] and it is not working.
Again thank you for hanging in here with me. I would really like to get this to work and I feel I am super close.

AlexisWilke’s picture

Once the node is loaded, and as far as I know you only want to enter the ID (1198 by itself), you need to edit the Lock action and select that node as the input for the action. Otherwise, it will still use the Thank you node...

Thank you.
Alexis

cathyhutzler’s picture

Priority: Major » Normal
Status: Fixed » Closed (fixed)

Thank you. That is exactly what I was missing. I did not go back and edit the action for lock node from current user and select the node id I loaded.

jonwithhtop’s picture

I'm having this same issue. Is there anyway you could write detailed steps on how to do this with Drupal 7 and Rulex 2x

AlexisWilke’s picture

I updated the documentation for Drupal 6.x:

https://secure.m2osw.com/doc-protected-node-rules#logout

I do not deal with D7 at all!

tostinni’s picture

Issue summary: View changes

For those looking for a simple solution in Drupal 7, here is some simple code to implement a link to disconnect a user.

In a custom module add those lines :

/**
* Implements hook_menu().
*/
function CUSTOM_MODULE_menu() {
  $items['protected-node-logout/%'] = array(
    'page callback' => 'CUSTOM_MODULE_protected_logout',
    'page arguments' => array(1),
    'type' => MENU_CALLBACK,
    'access arguments' => array('access content'),
  );
  return $items;
}

/**
 * Fallback to logout a protected node.
 */
function CUSTOM_MODULE_protected_logout($nid) {
  if ($nid && isset($_SESSION['_protected_node']['passwords'][$nid])) {
    unset($_SESSION['_protected_node']['passwords'][$nid]);
    drupal_set_message(t('You have been disconnected.'));
    drupal_goto();
  }
}

Then in a node template you can add :

if (isset($_SESSION['_protected_node']['passwords'][$node->nid])) {
  // Display logout link
  echo l(t('Disconnect'), 'protected-node-logout/'. $node->nid, array('attributes' => array('class' => array('protected-logout'))));
}