able to handle launcher login

This commit is contained in:
bruckwubete
2018-06-29 10:07:06 -04:00
parent 3748bb2140
commit e3e32365d0
9 changed files with 69 additions and 29 deletions

View File

@ -6,6 +6,7 @@ class ApplicationController < ActionController::Base
include SessionsHelper
protect_from_forgery with: :exception
skip_before_filter :verify_authenticity_token
MEETING_NAME_LIMIT = 90
USER_NAME_LIMIT = 30

View File

@ -5,6 +5,14 @@ class MainController < ApplicationController
# GET /
def index
if current_user
# Redirect authenticated users to their room.
redirect_to room_path(current_user.room)
else
# Redirect unauthenticated users to root.
#TODO use env? for launcher login endpoint
redirect_to "#{Rails.configuration.relative_url_root}/auth/bn_launcher"
end
end
private

View File

@ -65,6 +65,22 @@ class User < ApplicationRecord
def google_image(auth)
auth['info']['image']
end
def bn_launcher_name(auth)
auth['user_info']['username']
end
def bn_launcher_username(auth)
auth['user_info']['username']
end
def bn_launcher_email(auth)
auth['user_info']['email']
end
def bn_launcher_image(auth)
""
end
end
# Retrives a list of all a users rooms that are not the main room, sorted by last session date.