RSS

Newsletter

The CodeKarate Newsletter is the best way for technical ninjas to keep their swords sharpened. Don't worry, we won't flood your inbox and your email address will always remain private.
Back to Top

Drupal 7 LoginToboggan Module

Episode Number: 
35

The Drupal 7 LoginToboggan Module provides additional features to enhance the standard Drupal login system. Some of these features include allowing a user to use their email address to log in, or to be automatically logged in when creating an account.

In this episode, you will learn:

  • How to use the Login Toboggan module to allow users to log into a Drupal 7 website with their email address.
  • How to use the LoginToboggan module to allow users create a password and log in automatically when creating an account.
  • More configuration options that are available in the LoginToboggan module.
DDoD Video: 
See video
Full Text: 

Hello there and welcome to another exciting episode of the Daily Dose of Drupal. Today we’re on Episode Number 35 and today we’re going to be covering the Login Toboggan Module but before we do that and before we get started you can follow me on Twitter @smthomas3, you can go to my website at codekarate.com and sign up for the newsletter which is right here if you haven’t done so already and if you have any ideas for a future episodes or modules you’d like me to cover topics you’d like me to explore a little more, go ahead and let me know either if it would be a contact form, send me an e-mail or go ahead and contact me on Twitter and I have quite a few request, I’m trying to get through them so if you request at me or mention the module, I probably will get to it eventually, it just might take me a little bit to get through it all.

So I’m going to go ahead and download this Login Toboggan Module and as you can see from the drupal.org project page it does some pretty cool things, not only does it have a cool name but it also does a lot of cool things to help improve the Drupal standard login system.

So it allows users to login using their user name or their e-mail address, it allows users to be able to login immediately after creating an account rather than simply waiting for the e-mail clicking the confirmation link and then going to the website so you can give them a user pre-authenticated role once they click the confirmation in the e-mail then they can get the fully authenticated roles, there’s a lot of things you can do there.

It does a whole bunch of other things and we’ll try to get through quite a few of them here. So I’m going to go ahead and hop into the command line and download the Login Toboggan Module; it looks like I already had it downloaded but I’ll go ahead and just overwrite it. You can see it contains four modules; Login Toboggan Content Access Integration, Login Toboggan Variable, Login Toboggan Rules and just Login Toboggan.

There’s other three modules that Content Access, Variable and Rules are just integrations with other Drupal Modules. We’re not going to worry about those right now, we’re going to go ahead and just enable the Login Toboggan Module and I will come over to our test site, go to the Modules page and I will find the Login Toboggan Module and using the Module Filter module and if you watched the previous episodes of the Daily Dose of Drupal we went over this Module Filter module which allows you to filter this.

Make sure … I notice there’s a few bugs when you’re searching and trying to enable modules so if you’re having that issue make sure to use the most recent dev version of the module and it seems to fix it I believe. So we’re going to go ahead and click on Configure here; this is going to take us to the Login Toboggan administration page. So here we can select if we want users to be able to login in using their e-mail address so I’ll go ahead and enable that.

Here you can allow your site to show one login … select Registration Page, we’ll go ahead and select that, you can also allow two e-mail fields on the registration form and this is just use to prevent user for mistyping their e-mail address, you can allow user to set their initial password which will go ahead and use that one as well and it’s going to … you can set a non-authenticated role so basically when they first login … so when you allow them to set their password it will allow the user to login immediately and they will get this role once the user is then authenticated by clicking on the e-mail that they get, they will then get the regular authenticated users role.

What’s recommended if you see … if you read this is that you use a re-authorized role so you go into your … click on People, you go into the roles and you set up a pre-authenticated or pre-authorized role that has limited permissions, it doesn’t necessarily have all the authenticated permissions.

I’m going to go ahead and leave this for now but read this note here and make sure that you follow that if you’re doing this on this site which is going to be users actually using this frequently, you can have it delete on validated users after a set number of times and I will just use Cron to go ahead and clan up users that they haven’t validated their e-mail address.

Here is where it allows you to immediately login, it will allow you to set a redirect path and registration so you can go to any page on the site, I’m going to go ahead and find a page here; I’m just going to take this link and we’ll just redirect to Node 1 and then you could also set one after you go ahead and confirmed the e-mail that you get once you sign up for this site. You can set up the module to present a login form on the Access Denied page.

So if you go to an Access Denied section of the site you’ll get login in form that says you just have the access denied, you can display a login successful message, you can also set in a minimum password length. So go ahead and set a minimum password length of 8 in this example, so I’m going to save this and as you can see everything is pretty basic and straight forward and there’s really good information here in this description for each field and you should read those as it tells you a little bit more information and it will give you an idea of what it can be used for.

So I’m going to go ahead and logout and I’m going to click this Create New Account, you can see now there’s one page, it’s a little bit different than the Drupal standard tab system. So you can say I have an account, I mean, it’s similar but it is a little bit different, you can also click on and request a new password; I’m going to say I want to create an account; I’ll give it a Test User, I’ll give it an e-mail address, go ahead and confirm that and I’m only going to show you 6 characters and a password and you’ll see that I’ll get a message here and this is other fields that I’ve created in the past episodes but I’m going to ignore that and you see I got a message saying the password is too short so I’m going to go ahead and make sure I use an 8 character password, probably should make a little bit stronger but we’ll leave it for now, I will go ahead and hit Create New Account, you can see I was then redirected to node/1; it says “Thank you for applying for an account, it’s currently pending approval.”

But it did let me go ahead and logged in and I’m actually login as an authenticated user of the site so I was actually given that role, we’ll go ahead and logout and I’ll log back in as the Admin … well first of all you’ll notice I can use my user name or e-mail so I can … I’ll login as that user one more time and you can see I was able to login using the e-mail address instead of just the user name but I’ll login as an Admin here and I will go into the People section; you’ll see that Test User and it doesn’t show any roles but I do have the authenticated user role.

So that is the basics of the Login Toboggan Module, it’s very useful especially if you want users to be able to use their e-mail address instead of just the user name and you want to allow users to login without having to confirm the e-mail. If I went to my inbox now I would have an e-mail from the site that I would have the confirmation link on it and as it’s recommended in the Settings page you should have two roles; one as Pre-authentication and one then is the Authorized User of course or the Authenticated User and you can read here some additional things that it can do but it’s pretty simple module, it does greatly enhance the login system in Drupal in my opinion and I use it on a lot of larger sites that I’ve worked on.

So go ahead and give it a try and let me know what you think. Thanks for watching this episode of the Daily Dose of Drupal, until next time.

Discussions

1
Sil (not verified)

thanks

I completely forgot about this module, thanks for reminding me!
Do you happen to know if the email-verification Rules can be used when a user account is automatically created in the case of a Drupal Commerce product purchase?

1-1
shane

Not sure

I am not sure on that one. I haven't tried it out yet, but perhaps someone else has experience with using this module with Drupal Commerce. I will be working on some Drupal Commerce sites in the coming month or two and will try it out and let you know if/when I figure it out. Let me know if you figure it out before I do!

Thanks for the comment.

shane's picture
1-2
Sil (not verified)

Will do! Thanks.For your

Will do! Thanks.
For your Commerce sites: if you need automatic login at the point of purchase this article may help you:
http://s1l.org/automatic-user-login-anonymous-checkout
LoginToboggan can login before point of purchase if the user creates the account, not when the account is created after payment.

P.S. clickable urls in a comment/contact page trigger the Mollom spam filter

2
BenD (not verified)

Leave self registred users in temporary role

I like the principle of this module that:
1) A dedicated "non-authenticated" role can be assigned to a user that registers.
2) Approval to login to site is required via an email.
3) A user can immediately enter a site after registration and approval via email.

What I do not like, is that after the email approval, these new users automatically get to the "authenticated" role. I would like to keep them in the pre-assigned (temporary) role, until I am formally accept their registration manually.

So in other words, is there a way to have new users register to a site, have them validate their registration, and leave them with a role that allows them to do some more on the site, but in a restricted role, until the Administrator adds them to the approved users of the site?

3
Chris Valentine (not verified)

Change password page confusing

Its a great module but I still have an issue that's confusing some of our users, that being the verify account link (in the outgoing email) takes the user to the core "Change password" page. Now if the user has just set their password, that's immediately misleading. Neither of the redirection URLs in LT help because they don't override the destination of that activation link.

I tried [user:validate-url] instead of [user:one-time-login-url] in the outgoing email, but that causes other problems.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h2> <h3> <blockquote> <img>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <css>, <html>, <php>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <mysql>, <python>, <ruby>. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.