Skip to content

Commit

Permalink
don't clear session on login, could cause nasty bugs. Added has_token…
Browse files Browse the repository at this point in the history
… to end user.
  • Loading branch information
Doug Youch committed Mar 12, 2010
1 parent 27d3eeb commit 96150fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ def session_safe_clear
# Convenience method to log a user in
# sets the session and remember cookie
def process_login(usr,remember = false)
session_safe_clear
session[:user_id] = usr.id
session[:user_model] = usr.class.to_s
reset_myself
Expand Down
7 changes: 6 additions & 1 deletion app/models/end_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ def tokens=(val) #:nodoc:
@access_token_cache = val
end

def has_token?(token)
token = token.id if token.is_a?(AccessToken)
self.end_user_tokens.active.find_by_access_token_id(token)
end

after_save :token_cache_update

def token_cache_update #:nodoc:
Expand All @@ -203,7 +208,7 @@ def add_token!(tkn,options = { })
eut.update_attributes(options.slice(:valid_until,:target,:valid_at))
end
end

# Return a list of select options of all users
def self.select_options(editor=false)
self.find(:all, :order => 'last_name, first_name',:include => :user_class,
Expand Down

0 comments on commit 96150fc

Please sign in to comment.