Commit c41b74dc authored by jz143's avatar jz143

require login to see apps

parent 84652dbd
......@@ -12,8 +12,12 @@ class ApplicationController < ActionController::Base
private
def user_not_authorized
if current_user.nil?
redirect_to('/auth/duke_oauth2?' + {origin: request.fullpath}.to_query)
else
flash[:alert] = "You are not authorized to perform this action."
redirect_to(request.referrer || root_path)
end
end
end
......@@ -43,7 +43,7 @@ class SessionsController < ApplicationController
user = User.find_or_create_by_netid(auth_hash.info.netid)
session[:user_id] = user.id
redirect_to :root, notice: 'Welcome!'
redirect_to(request.env['omniauth.origin'] || :root, notice: 'Welcome!')
end
protected
......
......@@ -11,7 +11,7 @@ class AppPolicy < ApplicationPolicy
end
def show?
true
user
end
def create?
......
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