sign_in and sign_up views present og meta infos (#5308)

This commit is contained in:
takayamaki 2017-10-11 07:52:25 +09:00 committed by Eugen Rochko
parent 03457653e9
commit cfab4a7ce4
7 changed files with 18 additions and 2 deletions

View file

@ -6,6 +6,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
before_action :check_enabled_registrations, only: [:new, :create] before_action :check_enabled_registrations, only: [:new, :create]
before_action :configure_sign_up_params, only: [:create] before_action :configure_sign_up_params, only: [:create]
before_action :set_sessions, only: [:edit, :update] before_action :set_sessions, only: [:edit, :update]
before_action :set_instance_presenter, only: [:new, :update]
def destroy def destroy
not_found not_found
@ -39,6 +40,10 @@ class Auth::RegistrationsController < Devise::RegistrationsController
private private
def set_instance_presenter
@instance_presenter = InstancePresenter.new
end
def determine_layout def determine_layout
%w(edit update).include?(action_name) ? 'admin' : 'auth' %w(edit update).include?(action_name) ? 'admin' : 'auth'
end end

View file

@ -8,6 +8,7 @@ class Auth::SessionsController < Devise::SessionsController
skip_before_action :require_no_authentication, only: [:create] skip_before_action :require_no_authentication, only: [:create]
skip_before_action :check_suspension, only: [:destroy] skip_before_action :check_suspension, only: [:destroy]
prepend_before_action :authenticate_with_two_factor, if: :two_factor_enabled?, only: [:create] prepend_before_action :authenticate_with_two_factor, if: :two_factor_enabled?, only: [:create]
before_action :set_instance_presenter, only: [:new]
def create def create
super do |resource| super do |resource|
@ -84,6 +85,10 @@ class Auth::SessionsController < Devise::SessionsController
private private
def set_instance_presenter
@instance_presenter = InstancePresenter.new
end
def home_paths(resource) def home_paths(resource)
paths = [about_path] paths = [about_path]
if single_user_mode? && resource.is_a?(User) if single_user_mode? && resource.is_a?(User)

View file

@ -3,7 +3,7 @@
- content_for :header_tags do - content_for :header_tags do
= javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous' = javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous'
= render partial: 'og' = render partial: 'shared/og'
.landing-page .landing-page
.header-wrapper.compact .header-wrapper.compact

View file

@ -4,7 +4,7 @@
- content_for :header_tags do - content_for :header_tags do
%script#initial-state{ type: 'application/json' }!= json_escape(@initial_state_json) %script#initial-state{ type: 'application/json' }!= json_escape(@initial_state_json)
= javascript_pack_tag 'about', integrity: true, crossorigin: 'anonymous' = javascript_pack_tag 'about', integrity: true, crossorigin: 'anonymous'
= render partial: 'og' = render partial: 'shared/og'
.landing-page .landing-page
.header-wrapper .header-wrapper

View file

@ -1,6 +1,9 @@
- content_for :page_title do - content_for :page_title do
= t('auth.register') = t('auth.register')
- content_for :header_tags do
= render partial: 'shared/og'
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| = simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
= render 'shared/error_messages', object: resource = render 'shared/error_messages', object: resource

View file

@ -1,6 +1,9 @@
- content_for :page_title do - content_for :page_title do
= t('auth.login') = t('auth.login')
- content_for :header_tags do
= render partial: 'shared/og'
= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| = simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
= f.input :email, autofocus: true, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email') } = f.input :email, autofocus: true, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }
= f.input :password, placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off' } = f.input :password, placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off' }