Commit 550076d8cbf1390331d224945b656c58bb69f195
1 parent
98ad3513
Exists in
staging
and in
1 other branch
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,6 +44,13 @@ module Noosfero | ||
44 | present user, :with => Entities::UserLogin, :current_person => current_person | 44 | present user, :with => Entities::UserLogin, :current_person => current_person |
45 | end | 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 | # Create user. | 54 | # Create user. |
48 | # | 55 | # |
49 | # Parameters: | 56 | # Parameters: |