matthooks / authlogic-activation-tutorial

This URL has Read+Write access

100644 13 lines (7 sloc) 0.837 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
Let's see if things are working...
 
... (processing) ...
 
Looks like our user got activated!
 
But there's a slight problem. Since we didn't update the user's password, we didn't get a magical Authlogic auto-login! How rude.
 
At this point it's perfectly fine to let the user log themselves in. And you can certainly simplify the activation down to one action so the user doesn't have to click another button. But, I like Authlogic's session maintenance. I also like short signup forms. So let's kill two birds with one stone.
 
Let's set up the user creation form to only ask for a user's login/email. Then, let's ask the user to set their password/openid upon activation, which will log them in automatically.
 
First, let's change our acts_as_authentic call to only check for password length on update if the user has no credentials set.