From 6d3d08daad6c439b30d5f193d332b5042883d459 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 8 Aug 2019 13:57:18 +0100 Subject: [PATCH] UX: Hide login/signup header buttons during authentication flows --- app/controllers/session_controller.rb | 2 +- app/controllers/users/omniauth_callbacks_controller.rb | 1 + app/views/application/_header.html.erb | 2 +- app/views/layouts/no_ember.html.erb | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/session_controller.rb b/app/controllers/session_controller.rb index 4acc0b2a2a4..08a3d9f249e 100644 --- a/app/controllers/session_controller.rb +++ b/app/controllers/session_controller.rb @@ -387,7 +387,7 @@ class SessionController < ApplicationController @error = I18n.t('user_api_key.invalid_token') end - render layout: 'no_ember' + render layout: 'no_ember', locals: { hide_auth_buttons: true } end def forgot_password diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index c35ae5a1c98..82393bfa9a1 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -20,6 +20,7 @@ class Users::OmniauthCallbacksController < ApplicationController def confirm_request self.class.find_authenticator(params[:provider]) + render locals: { hide_auth_buttons: true } end def complete diff --git a/app/views/application/_header.html.erb b/app/views/application/_header.html.erb index b2d328ecf38..7287acfce04 100644 --- a/app/views/application/_header.html.erb +++ b/app/views/application/_header.html.erb @@ -12,7 +12,7 @@ <%- end %> - <%- unless current_user %> + <%- unless current_user || local_assigns[:hide_auth_buttons] %>
<%- if can_sign_up? %> " class='btn btn-primary btn-small signup-button'><%= I18n.t('sign_up') %> diff --git a/app/views/layouts/no_ember.html.erb b/app/views/layouts/no_ember.html.erb index 4a0264b0055..196d658ef27 100644 --- a/app/views/layouts/no_ember.html.erb +++ b/app/views/layouts/no_ember.html.erb @@ -16,7 +16,7 @@ <%= theme_lookup("header") %> <%= build_plugin_html 'server:header' %>
- <%= render partial: 'header' %> + <%= render partial: 'header', locals: { hide_auth_buttons: local_assigns[:hide_auth_buttons] } %>
<%= yield %>