1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Fix for failed first-ever logins on PostgreSQL where column default is nil

This commit is contained in:
James Miller 2010-09-02 05:32:51 +08:00 committed by José Valim
parent 006f48232f
commit 0f0eb4e8ce

View file

@ -82,6 +82,8 @@ module Devise
when TrueClass when TrueClass
self.failed_attempts = 0 self.failed_attempts = 0
when FalseClass when FalseClass
# PostgreSQL uses nil as the default value for integer columns set to 0
self.failed_attempts ||= 0
self.failed_attempts += 1 self.failed_attempts += 1
if attempts_exceeded? if attempts_exceeded?
lock_access! lock_access!