Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2014-07-10 15:10:37 +0400
committerMarin Jankovski <marin@gitlab.com>2014-07-10 15:10:37 +0400
commit1e3fce1a82ee3583f2e209f48c30b964e32a637c (patch)
treea0de6270317f331bf21edc789c59dc3e09154a81 /app
parent4024aa8e812a546b0d6c9110b6b8d36d327961fc (diff)
Check for the correct param for token.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 6128f6e48ed..9700447f78d 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -30,8 +30,13 @@ class ApplicationController < ActionController::Base
protected
# From https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example
+ # https://gist.github.com/josevalim/fb706b1e933ef01e4fb6
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)
if user