Commit 550076d8cbf1390331d224945b656c58bb69f195

Authored by Victor Costa
1 parent 98ad3513

api: login from noosfero cookie

Showing 1 changed file with 7 additions and 0 deletions   Show diff stats
lib/noosfero/api/session.rb
... ... @@ -44,6 +44,13 @@ module Noosfero
44 44 present user, :with => Entities::UserLogin, :current_person => current_person
45 45 end
46 46  
  47 + post "/login_from_cookie" do
  48 + user = User.where(remember_token: cookies[:auth_token]).first
  49 + return unauthorized! unless user && user.activated?
  50 + @current_user = user
  51 + present user, :with => Entities::UserLogin, :current_person => current_person
  52 + end
  53 +
47 54 # Create user.
48 55 #
49 56 # Parameters:
... ...