Skip to content

Commit

Permalink
Fixes several issues with version migration.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmastey committed Jan 30, 2017
1 parent dee4a46 commit d51f48f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -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
10 changes: 5 additions & 5 deletions app/controllers/api/v1/users_controller.rb
Expand Up @@ -18,21 +18,21 @@ def show
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
unescape_token(token)
@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)
Expand Down
5 changes: 3 additions & 2 deletions app/controllers/users_controller.rb
Expand Up @@ -25,8 +25,9 @@ def account_settings

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
Expand Down

0 comments on commit d51f48f

Please sign in to comment.