Drupal 7 Automated Logout

By shane
Mon, 2012-12-31 23:46
0 comments
Daily Dose of Drupal Episode #77

The Drupal 7 Automated Logout module makes it easy to logout users of your Drupal 7 website automatically after a set amount of time. This can be useful for security purposes to help prevent unauthorized access from other individuals that may be using the same computer. This module also has some extra features to allow timeouts to be configured by role and even some settings that can be configured on an individual user basis.

In this episode you will learn:

  • How to determine which version of the module will be best for your needs
  • How to configure the Drupal 7 Automated Logout module

Hello everyone and welcome to another Daily Dose of Drupal, this is Episode Number 77. As always I’m Shane, you can follow me on Twitter @smthomas3, you can also go to codekarate.com and check out the other Daily Dose of Drupal videos and sign up for the newsletter if you haven’t already and stay tuned for upcoming courses on Drupal and other web development things.

Today since it’s the last day of 2012 we’re going to go over something very simple but very useful for certain websites and the module that we’re going to be going over today is the Automated Logout Module. In fact the trickiest part of this module is actually just choosing which version to use.

As you can see there’s the 7.x-2.0-beta one version which is the recommended release but there’s also the 7.x-4.0 version that’s another other release, there’s also the 4.x-dev which is the version that I am using in this demo. I’ve tried all three of the versions that are here for the 7 or at least the top three versions for Drupal 7 and I’ve been able to get all of them to work for just a simple situation of logging a user out after a specific set of time but you may need to of course try the ones out and figure out which works best.

We’re going to go ahead and get started with just a very simple example; we’ll go ahead and login to my test site here, I already have the 4.x-dev module installed so I’ll come in to the auto logout settings and you can see the configuration page is relatively straight forward. First you’re able to set the time out in seconds, I’m going to set this to 60 so we’ll keep this nice and short. This is the max time out settings and I believed this setting is used because there’s a setting on a user’s account page which I’ll go over.

I think this is the max value that can be entered in that field, we’ll go over that after a couple of seconds here and the time of padding is how many seconds to give a user after the nice little logout dialog window comes up, warning the user to about to be logged out.

You could also set a role timeout which is what I’m going to do. I’m going to set that all authenticated users are going logout after 60 seconds; you could also vary the roles depending on if you had multiple roles on your site but I’ll just keep it simple and say just authenticated users which in theories all logged in users after 60 seconds. Where we want the redirect to go? To the login page of course and the message to display in the dialog window, you can also enable logging and enforced the logout on admin pages like the one that I am on right now.

We’ll go ahead and give this a save and we will logout and login as just another authenticated user just to give it a true test and while this is waiting here for approximately I minute just take … I’m just going to take some time to remind you that if you’re using a dev version of a module or an alpha or a beta version for that matter just be prepare that not everything may be as it should be or there may be bugs, there may be issues or new features that you think need to be added. Just keep in mind that you should check the issue queue on drupal.org and see if your issue or your feature has been requested and you may find a fix there or you may have to post one yourself, just make sure you’re doing adequate research ahead of time before you are posting your own issues.

As I’ve mentioned before I’ve been able to get all of the modules to all three versions that I tried to work however I would usually recommend going with the newest version and as you can see we now got our session is about to expire and you want to reset it, I can click Yes and it will continue my session.

If I would click no it would bring me to the user login page. But as I was always mentioning I generally tend to use the newer version so in this case the 4.0 just because in general this isn’t always true but in general it’s going to be the more supported version going forward into the future.

So if it has all the features you need I generally like to use the newer version because that’s generally where the feature is going for the module. I’m going to go ahead and log back in as the Admin User and just show you one other small thing. In each users account there is a … your current logout threshold. So this is how many seconds the user has to respond to the logout dialog before it ends their session and this can be configured on a per user basis if the permissions are set accordingly.

So if you come into permissions there’s Automated Logout Permissions. You can allow users to change their own logout threshold and I haven’t tested this portion so I can’t vows that it is working, I’m assuming it is but if it’s something that you’ll need on your site you’ll have to give it a test and try it out. So that’s really all there is to this episode of the Daily Dose of Drupal and we’ll be back again next time in 2013 with some more exciting episodes. So thanks for watching and sign up for the newsletter if you haven’t already. See you next time.

Need to learn more Drupal?

Premium Drupal Training Online (Horizontal)

Post new comment