diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 31b960b73..e5e5f6b6f 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -4,8 +4,6 @@ class SessionsController < ApplicationController def new end -# oauth information: -# http://net.tutsplus.com/tutorials/ruby/how-to-use-omniauth-to-authenticate-your-users/ def create user = User.authenticate(params[:session][:email], params[:session][:password]) @@ -18,6 +16,8 @@ class SessionsController < ApplicationController end end +# OAuth docs +# http://net.tutsplus.com/tutorials/ruby/how-to-use-omniauth-to-authenticate-your-users/ def create_oauth auth_hash = request.env['omniauth.auth'] authorization = UserAuthorization.find_by_provider_and_uid(auth_hash["provider"], auth_hash["uid"]) @@ -49,9 +49,10 @@ class SessionsController < ApplicationController nil, # @country nil, nil) - user.user_authorizations.build :provider => auth_hash[:provider], :uid => auth_hash[:uid], - :token => auth_hash[:credentials][:token], :token_expiration => auth_hash[:credentials][:expires_at] + auth = user.user_authorizations.build :provider => auth_hash[:provider], :uid => auth_hash[:uid], + :token => auth_hash[:credentials][:token], :token_expiration => Time.at(auth_hash[:credentials][:expires_at]) user.save + auth.save complete_sign_in user end end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index cf892e07f..b3edd0a32 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -7,6 +7,6 @@ module UsersHelper hclass = options[:hclass] gravatar = gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}" - image_tag(gravatar_url, alt: user.name, class: "#{hclass}") + image_tag(gravatar_url, alt: "#{user.first_name} #{user.last_name}", class: "#{hclass}") end end diff --git a/app/views/clients/index.html.erb b/app/views/clients/index.html.erb index debe69e50..b52d70c06 100644 --- a/app/views/clients/index.html.erb +++ b/app/views/clients/index.html.erb @@ -21,7 +21,7 @@
New user? <%= link_to "Sign up now!", signup_path %>