mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
parent
62fbeadf34
commit
c257983cdd
7 changed files with 46 additions and 13 deletions
3
app/views/registrar/base/_current_user.html.erb
Normal file
3
app/views/registrar/base/_current_user.html.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
<%= "#{current_user} (#{current_user.roles.first}) - #{current_user.registrar}" %>
|
||||
<span class="text-muted">|</span>
|
||||
<%= link_to t('.sign_out'), registrar_destroy_user_session_path, method: :delete %>
|
|
@ -16,14 +16,5 @@
|
|||
- active_class = ['registrar/xml_consoles'].include?(params[:controller]) ? 'active' :nil
|
||||
%li{class: active_class}= link_to t(:xml_console), registrar_xml_console_path
|
||||
|
||||
%ul.nav.navbar-nav.navbar-right
|
||||
%li.dropdown
|
||||
%a.dropdown-toggle{"data-toggle" => "dropdown", href: "#"}
|
||||
= "#{current_user} (#{current_user.roles.first}) - #{current_user.registrar}"
|
||||
%span.caret
|
||||
%ul.dropdown-menu{role: "menu"}
|
||||
- current_user.linked_users.each do |user|
|
||||
%li= link_to "#{user} (#{user.roles.first}) - #{user.registrar}", registrar_switch_current_user_path(user),
|
||||
id: "switch-current-user-#{user.id}-btn"
|
||||
- if user_signed_in?
|
||||
%li= link_to t(:log_out_), '/registrar/logout'
|
||||
%div.navbar-text.navbar-right
|
||||
= render 'current_user'
|
||||
|
|
|
@ -816,7 +816,6 @@ en:
|
|||
notes: Notes
|
||||
active_price_for_this_operation_is: 'Active price for this operation is %{price}'
|
||||
active_price_missing_for_this_operation: 'Active price missing for this operation!'
|
||||
log_out_: 'Log out'
|
||||
valid_to_from: 'Valid to from'
|
||||
valid_to_until: 'Valid to until'
|
||||
registrant_ident: 'Registrant ident'
|
||||
|
|
5
config/locales/registrar/base.en.yml
Normal file
5
config/locales/registrar/base.en.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
en:
|
||||
registrar:
|
||||
base:
|
||||
current_user:
|
||||
sign_out: Log out
|
|
@ -44,7 +44,7 @@ Rails.application.routes.draw do
|
|||
post 'id' => 'sessions#id'
|
||||
post 'mid' => 'sessions#mid'
|
||||
get 'switch_user/:id' => 'sessions#switch_user'
|
||||
get 'logout' => '/devise/sessions#destroy'
|
||||
delete 'logout', to: '/devise/sessions#destroy', as: :destroy_user_session
|
||||
end
|
||||
|
||||
get 'current_user/switch/:new_user_id', to: 'current_user#switch', as: :switch_current_user
|
||||
|
|
15
spec/features/registrar/sign_out_spec.rb
Normal file
15
spec/features/registrar/sign_out_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Registrar area sign-out', settings: false do
|
||||
background do
|
||||
Setting.registrar_ip_whitelist_enabled = false
|
||||
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance))
|
||||
end
|
||||
|
||||
scenario 'signs the user out' do
|
||||
visit registrar_root_path
|
||||
click_on t('registrar.base.current_user.sign_out')
|
||||
|
||||
expect(page).to have_text('Signed out successfully.')
|
||||
end
|
||||
end
|
20
spec/requests/registrar/sign_out_spec.rb
Normal file
20
spec/requests/registrar/sign_out_spec.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Registrar area sign-out', settings: false do
|
||||
describe 'sign-out' do
|
||||
before do
|
||||
sign_in_to_registrar_area
|
||||
end
|
||||
|
||||
it 'signs the user out' do
|
||||
delete registrar_destroy_user_session_path
|
||||
follow_redirect!
|
||||
expect(controller.current_user).to be_nil
|
||||
end
|
||||
|
||||
it 'redirects to login url' do
|
||||
delete registrar_destroy_user_session_path
|
||||
expect(response).to redirect_to(registrar_login_url)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue