canvas-lms/app/views/shared/unauthorized.html.erb

61 lines
3.2 KiB
Plaintext

<% content_for :page_title do %>
<% if !@files_domain && (!@current_user || @unauthorized_user) %>
<%= t('titles.log_in', %{Please Log In}) %>
<% else %>
<%= t('titles.unauthorized_action', %{Unauthorized}) %>
<% end %>
<% end %>
<% content_for :stylesheets do %>
<style>
#unauthorized_holder #modal-box {
margin-top: 10px;
}
</style>
<% end %>
<% @show_left_side = false %>
<% if (@unauthorized_user && @current_user && @current_user != @unauthorized_user) || @unauthorized_user || @unauthorized_message || @context || @needs_cookies %>
<div class="ui-state-error" style="margin:30px auto 0; padding: 1em; width: 640px;" >
<h2 style="text-align:center;">
<% if @needs_cookies -%>
<%= t('headings.needs_cookies', %{Cookies Required}) %>
<% elsif !@files_domain && (!@current_user || @unauthorized_user) -%>
<%= t('headings.needs_login', %{Please Log In}) %>
<% else -%>
<%= t('headings.unauthorized_action', %{Unauthorized}) %>
<% end -%>
</h2>
<% if @unauthorized_user && @current_user && @current_user != @unauthorized_user %>
<p><%= mt 'unauthorized_user_is_other', "%{current_user}, you are not authorized to view this page. The link you followed to get here was for **%{unauthorized_user} (%{unauthorized_user_email})**. If that's you, you may want to log out and log back in with that email address to gain access to this page.", :current_user => @current_user.name, :unauthorized_user => @unauthorized_user.name, :unauthorized_user_email => @unauthorized_user.email %>
</p>
<% elsif @unauthorized_user %>
<p>
<%= t 'unauthorized_user', %[%{user_name}, you'll need to log in before you can view that page. Click "Forgot Password" if you forgot or don't know your password.], :user_name => @unauthorized_user.name %>
</p>
<% elsif @unauthorized_message %>
<p><%= @unauthorized_message %></p>
<% elsif @needs_cookies %>
<p><%= t('needs_cookies', %{Cookies are not enabled on your browser. Please adjust this in your security preferences before continuing.}) %></p>
<% elsif @files_domain %>
<p><%= t('needs_login', %{Access to this page is limited to authorized users. You do not have currently have permission to view this page.}) %></p>
<% elsif !@current_user %>
<p><%= t('unauthorized_action', %{Access to this page is limited to authorized users. You will need to log in before you can view the content on this page.}) %></p>
<% elsif @context %>
<p>
<% if @context.try_rescue(:is_public) %>
<%= mt 'public_course', 'This page is part of the content for the course, **%{course}**.', :course => @context.name %>
<% end %>
<%= t('unauthorized_1', %{It appears that you don't have permission to access this page. Please make sure you're authorized to view this content.}) %>
<% if Setting.get_cached("show_feedback_link", "false") == "true" %>
<%= t('unauthorized_2', %{If you think you should be able to view this page, please use the "Help" link to notify support of the problem.}) %>
<% end %>
</p>
<% end %>
</div>
<% end %>
<% if !@current_user && !@files_domain %>
<div id="unauthorized_holder">
<%= render :partial => "shared/login" %>
</div>
<% end %>