Skip to content
Snippets Groups Projects
Commit 1e3fce1a authored by Marin Jankovski's avatar Marin Jankovski
Browse files

Check for the correct param for token.

parent 4024aa8e
No related branches found
No related tags found
No related merge requests found
Loading
@@ -30,8 +30,13 @@ class ApplicationController < ActionController::Base
Loading
@@ -30,8 +30,13 @@ class ApplicationController < ActionController::Base
protected protected
   
# From https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example # From https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example
# https://gist.github.com/josevalim/fb706b1e933ef01e4fb6
def authenticate_user_from_token! def authenticate_user_from_token!
user_token = params[:user_token].presence user_token = if params[:authenticity_token].presence
params[:authenticity_token].presence
elsif params[:private_token].presence
params[:private_token].presence
end
user = user_token && User.find_by_authentication_token(user_token.to_s) user = user_token && User.find_by_authentication_token(user_token.to_s)
   
if user if user
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment