# Authlogic: activating inactive account/user

**URL:** <https://www.ruby-forum.com/t/authlogic-activating-inactive-account-user/193926>\
**Category:** Rails\
**Created:** [August 26, 2010, 5:31pm UTC](https://www.ruby-forum.com/t/authlogic-activating-inactive-account-user/193926 "2010-08-26T17:31:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [August 26, 2010, 5:31pm UTC](https://www.ruby-forum.com/t/authlogic-activating-inactive-account-user/193926/1 "2010-08-26T17:31:46Z")

</div>

Hello,

I have searched high and low on how to activate an inactive account in  
Authlogic and I can’t seem to figure it out.

I am using “consecutive\_failed\_logins\_limit” to control a brute force  
attack and I want to offer a function so a ‘manager’ can enable the  
inactive account and bypass the number of hours/minutes the user would  
need to wait to attempt to login otherwise.

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [August 26, 2010, 11:16pm UTC](https://www.ruby-forum.com/t/authlogic-activating-inactive-account-user/193926/2 "2010-08-26T23:16:36Z")

</div>

Did you try resetting failed\_login\_count to 0?

d.

---

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [August 27, 2010, 1:30am UTC](https://www.ruby-forum.com/t/authlogic-activating-inactive-account-user/193926/3 "2010-08-27T01:30:41Z")

</div>

Yep, among other things. What I have gathered so far (although I could  
be wrong) is that Authlogic validations happen for UserSession before  
anything else. I believe that authlogic then goes and grabs info from  
the session and does its thing (which I don’t know yet what it is) and  
marks the user as inactive and ends the process, redirecting the user  
to the login screen.

---

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [August 27, 2010, 1:57am UTC](https://www.ruby-forum.com/t/authlogic-activating-inactive-account-user/193926/4 "2010-08-27T01:57:36Z")

</div>

Yep, among other things. What I have gathered so far (although I could  
be wrong) is that Authlogic validations happen for UserSession before  
anything else. I believe that authlogic then goes and grabs info from  
the session and does its thing (which I don’t know yet what it is) and  
marks the user as inactive and ends the process, redirecting the user  
to the login screen.

---

<div class="post-metadata">

**Author:** ![pepe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4da419/32.png) [@pepe](https://www.ruby-forum.com/u/pepe)\
**Post date:** [August 27, 2010, 5:32am UTC](https://www.ruby-forum.com/t/authlogic-activating-inactive-account-user/193926/5 "2010-08-27T05:32:59Z")

</div>

That’s how it’s done in brute\_force\_protection.rb:  
def reset\_failed\_login\_count  
attempted\_record.failed\_login\_count = 0  
end

You could test your assumption by resetting the count and then  
clearing the browser cache or trying to log on from a different  
computer. If so, take a look at your user\_session#new (assuming it  
redirects to the log in page on failure). You should be setting the  
@user\_session (or whatever you named it) instance var there.
