Skip to content

Commit

Permalink
don't display "Please Log In" when the user is logged in
Browse files Browse the repository at this point in the history
test plan:
 - as a logged-in user, go to a page you don't have permission to see
   (e.g., a student accessing the gradebook)
 - the page title should say "Unauthorized", not "Please Log In"

fixes ADMIN-1371

Change-Id: Ibf9a3241ecece2cff27cce4692d8dcacee85c944
Reviewed-on: https://gerrit.instructure.com/161752
Tested-by: Jenkins
Reviewed-by: Rob Orton <[email protected]>
Product-Review: Jon Willesen <[email protected]>
QA-Review: Jon Willesen <[email protected]>
  • Loading branch information
jstanley0 committed Aug 24, 2018
1 parent cf1c32b commit eb75cdc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
2 changes: 1 addition & 1 deletion app/views/login/canvas/_new_login_content.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<label for="pseudonym_session_unique_id_forgot" class="ic-Label">
<%= login_handle_name %>
</label>
<input aria-describedby="forgot_password_instructions" class="ic-Input email_address text" type="text" name="pseudonym_session[unique_id_forgot]" value="<%= @unauthorized_user.email rescue '' %>" id="pseudonym_session_unique_id_forgot" />
<input aria-describedby="forgot_password_instructions" class="ic-Input email_address text" type="text" name="pseudonym_session[unique_id_forgot]" value="" id="pseudonym_session_unique_id_forgot" />

</div>
<div class="ic-Form-control ic-Form-control--login">
Expand Down
2 changes: 1 addition & 1 deletion app/views/login/canvas/mobile_login.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
autocorrect="off"
type="<%= @login_handle_is_email ? 'email' : 'text' %>"
name="pseudonym_session[unique_id_forgot]"
value="<%= @unauthorized_user.try :email %>"
value=""
placeholder="<%= @login_handle_name %>"
id="pseudonym_session_unique_id_forgot" />
</div>
Expand Down
18 changes: 2 additions & 16 deletions app/views/shared/unauthorized.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@
%>

<% content_for :page_title do %>
<% if !@files_domain && !@unauthorized_user %>
<%= t('titles.log_in', %{Please Log In}) %>
<% else %>
<%= t('titles.unauthorized_action', %{Unauthorized}) %>
<% end %>

<%= t('titles.unauthorized_action', %{Unauthorized}) %>
<% end %>
<% @show_left_side = false %>
<% @show_embedded_chat = false %>
Expand All @@ -32,22 +27,13 @@
<h2 class="ui-state-error">
<% if @needs_cookies -%>
<%= t('headings.needs_cookies', %{Cookies Required}) %>
<% elsif !@files_domain && @unauthorized_user %>
<%= t('headings.needs_login', %{Please Log In}) %>
<% elsif @unauthorized_reason == :unpublished %>
<%= t('headings.unpublished', %{Not Yet Available}) %>
<% else -%>
<%= t('headings.unauthorized_action', %{Unauthorized}) %>
<% end -%>
</h2>
<% if @unauthorized_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 "%{user_name}, you'll need to *log in* before you can view that page.", user_name: @unauthorized_user.name, wrapper: link_to(login_url, '\1') %>
</p>
<% elsif @unauthorized_message %>
<% if @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>
Expand Down

0 comments on commit eb75cdc

Please sign in to comment.