Skip to content

Commit

Permalink
Fix creating new settings on every login
Browse files Browse the repository at this point in the history
  • Loading branch information
BatedUrGonnaDie committed Apr 3, 2015
1 parent 23ce329 commit eb12942
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Running locally for SaltyBot
`salty_web_secret` This should be the same as the web secret in python bot config file.
`DATABASE_URL` This should be a postgresql database.

Clone the repo, and run
Clone the repo, and run
`bundle install` followed by `rails server`

If something does not work correctly submit an issue so I can fix it.
3 changes: 2 additions & 1 deletion app/controllers/twitch_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ def from_twitch

if @user.nil?
@user = User.new(email: user_data['email'], twitch_id: user_data['_id'], twitch_name: user_data['name'])
new_user = True
end

@user.session = User.digest((SecureRandom.urlsafe_base64).to_s)

if @user.save
@user.create_settings!
@user.create_settings! if new_user
sign_in @user
redirect_to salty_path
else
Expand Down

0 comments on commit eb12942

Please sign in to comment.