Skip to content
Snippets Groups Projects
Unverified Commit 300788c0 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

fix devise js + extranet redirection when visitor

parent 7b081ad9
No related branches found
No related tags found
No related merge requests found
//= require activestorage
//= require popper
//= require bootstrap-sprockets
//= require jquery3
//= require jquery_ujs
//= require notyf/notyf.min
......
class Extranet::ApplicationController < ApplicationController
layout 'extranet/layouts/application'
before_action :authorize_extranet_access!
before_action :redirect_if_no_extranet!,
:authorize_extranet_access!
def breadcrumb
add_breadcrumb t('home'), root_path
......@@ -13,6 +14,10 @@ class Extranet::ApplicationController < ApplicationController
private
def redirect_if_no_extranet!
redirect_to admin_root_path unless current_extranet
end
def authorize_extranet_access!
raise CanCan::AccessDenied if current_user.visitor? && about.alumni.find_by(id: current_user.person&.id).nil?
end
......
class Extranet::HomeController < Extranet::ApplicationController
def index
return redirect_to admin_root_path unless current_extranet
@cohorts = about&.education_cohorts.ordered.limit(5)
@experiences = about&.university_person_experiences.ordered.limit(10)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment