Drupal 7 LoginToboggan Module
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.
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.