Fixes several issues with version migration.

This commit is contained in:
Joseph Mastey
2017-01-29 18:08:44 -06:00
parent dee4a46d3d
commit d51f48f2d9
3 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ before_install:
- "if [ $(phantomjs --version) != '2.1.1' ]; then tar -xvf ${PWD}/travis_phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C ${PWD}/travis_phantomjs; fi"
- "phantomjs --version"
before_script: bundle exec rails db:{setup,migrate}
before_script: bundle exec rails db:test:prepare
cache: bundler
sudo: false
env: RAILSGOAT_MAINTAINER=true
+5 -5
View File
@@ -18,12 +18,12 @@ class Api::V1::UsersController < ApplicationController
def valid_api_token
authenticate_or_request_with_http_token do |token, options|
# TODO :add some functionality to check if the HTTP Header is valid
identify_user(token)
if !identify_user(token)
redirect_to root_url
end
end
end
# TODO I don't believe returning from this method is a valid method
# of halting execution anymore.
def identify_user(token="")
# We've had issues with URL encoding, etc. causing issues so just to be safe
# we will go ahead and unescape the user's token
@@ -31,8 +31,8 @@ class Api::V1::UsersController < ApplicationController
@clean_token =~ /(.*?)-(.*)/
id = $1
hash = $2
(id && hash) ? true : false
check_hash(id, hash) ? true : false
check_hash(id, hash)
end
def check_hash(id, hash)
+3 -2
View File
@@ -25,8 +25,9 @@ class UsersController < ApplicationController
def update
message = false
user = User.where("user_id = '#{params[:user][:user_id]}'").first
user = User.where("user_id = '#{params[:user][:user_id]}'")[0]
if user
user.skip_user_id_assign = true
user.skip_hash_password = true