Skip to content

Commit

Permalink
Handle no identity attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
bcardarella committed Nov 2, 2012
1 parent 227283d commit f892a9c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/easy_auth/controllers/sessions.rb
Expand Up @@ -8,7 +8,7 @@ def new
def create
if identity = EasyAuth.authenticate(self)
identity.set_account_session(session)
identity.remember = params[ActiveModel::Naming.param_key(EasyAuth.find_identity_model(self).new)][:remember]
set_remember(identity)
if identity.remember
cookies[:remember_token] = { :value => identity.generate_remember_token!, :expires => identity.remember_time.from_now }
end
Expand Down Expand Up @@ -77,4 +77,10 @@ def method_missing(method_name, *args)
super
end
end

def set_remember(identity)
if identity_attributes = params[ActiveModel::Naming.param_key(EasyAuth.find_identity_model(self).new)]
identity.remember = identity_attributes[:remember]
end
end
end

0 comments on commit f892a9c

Please sign in to comment.