Commit 67f9d411 authored by Rafael Masoni's avatar Rafael Masoni
Browse files

Merge branch 'master' of github.com:railsrumble/r12-team-508

parents 61c76214 712e58f9
......@@ -3,7 +3,11 @@ class SessionsController < ApplicationController
def create
auth = request.env['omniauth.auth']
user = User.find_by(provider: auth['provider'], uid: auth['uid']) || User.create_with_omniauth(auth)
user = begin
User.find_by(provider: auth['provider'], uid: auth['uid'])
rescue
User.create_with_omniauth(auth)
end
session[:user_id] = user.id
redirect_to :chat
......
......@@ -16,7 +16,7 @@ class User
create! do |user|
user.provider = auth['provider']
user.uid = auth['uid']
user.login = auth['user_info']['name']
user.login = auth['user_info'] ? auth['user_info']['name'] : 'no login'
end
end
end
......@@ -3,5 +3,5 @@
= image_tag "user.png", alt: ""
.name= user.login
.char= user.nick
%button.sheet
%button.sheet{ 'data-id' => user.id }
Character Sheet
......@@ -2,3 +2,5 @@ Rails.application.config.middleware.use OmniAuth::Builder do
provider :developer unless Rails.env.production?
provider :twitter, 'OtgUJ38USbc3PnbRH1i9DA', 'sZGgzbqX3xPhzoVru6uzpIvrBwIRIQbrHVDG5CXrm8'
end
OmniAuth.config.full_host = "http://railspg.com"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment