diff --git a/app/controllers/registrar/account_controller.rb b/app/controllers/registrar/account_controller.rb
new file mode 100644
index 000000000..1bcf9e468
--- /dev/null
+++ b/app/controllers/registrar/account_controller.rb
@@ -0,0 +1,24 @@
+class Registrar
+ class AccountController < BaseController
+ skip_authorization_check
+
+ def show; end
+
+ def edit
+ @registrar = current_registrar_user.registrar
+ end
+
+ def update
+ @registrar = current_registrar_user.registrar
+ @registrar.update!(registrar_params)
+
+ redirect_to registrar_account_path, notice: t('.saved')
+ end
+
+ private
+
+ def registrar_params
+ params.require(:registrar).permit(:billing_email)
+ end
+ end
+end
\ No newline at end of file
diff --git a/app/controllers/registrar/profile_controller.rb b/app/controllers/registrar/profile_controller.rb
deleted file mode 100644
index 1fe6d6a0b..000000000
--- a/app/controllers/registrar/profile_controller.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class Registrar
- class ProfileController < BaseController
- skip_authorization_check
-
- helper_method :linked_users
-
- def show
- @user = current_registrar_user
- end
-
- private
-
- def linked_users
- current_registrar_user.linked_users
- end
- end
-end
diff --git a/app/controllers/registrar/sessions_controller.rb b/app/controllers/registrar/sessions_controller.rb
index e8873c584..c97c3155d 100644
--- a/app/controllers/registrar/sessions_controller.rb
+++ b/app/controllers/registrar/sessions_controller.rb
@@ -182,7 +182,7 @@ class Registrar
if can?(:show, :poll)
registrar_root_path
else
- registrar_profile_path
+ registrar_account_path
end
end
diff --git a/app/views/layouts/registrar/base.html.erb b/app/views/layouts/registrar/base.html.erb
index e3e93f89f..4d4f1b972 100644
--- a/app/views/layouts/registrar/base.html.erb
+++ b/app/views/layouts/registrar/base.html.erb
@@ -24,7 +24,7 @@
- <%= link_to can?(:show, :poll) ? registrar_root_path : registrar_profile_path,
+ <%= link_to can?(:show, :poll) ? registrar_root_path : registrar_account_path,
class: 'navbar-brand' do %>
<%= t(:registrar_head_title) %>
<% if unstable_env.present? %>
diff --git a/app/views/registrar/account/_details.html.erb b/app/views/registrar/account/_details.html.erb
new file mode 100644
index 000000000..9e35da899
--- /dev/null
+++ b/app/views/registrar/account/_details.html.erb
@@ -0,0 +1,16 @@
+
+
+ <%= t '.header' %>
+
+
+
+
+ - <%= Registrar.human_attribute_name :billing_email %>
+ - <%= registrar.billing_email %>
+
+
+
+
+
diff --git a/app/views/registrar/account/_form.html.erb b/app/views/registrar/account/_form.html.erb
new file mode 100644
index 000000000..c2bb6aa82
--- /dev/null
+++ b/app/views/registrar/account/_form.html.erb
@@ -0,0 +1,21 @@
+<%= form_for @registrar, url: registrar_account_path, method: :patch, html: { class: 'form-horizontal' } do |f| %>
+ <%= render 'form_errors', target: @registrar %>
+
+
+
+
+
+
+
+ <%= f.submit t('.submit_btn'), class: 'btn btn-success' %>
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/registrar/profile/_linked_users.html.erb b/app/views/registrar/account/_linked_users.html.erb
similarity index 100%
rename from app/views/registrar/profile/_linked_users.html.erb
rename to app/views/registrar/account/_linked_users.html.erb
diff --git a/app/views/registrar/account/edit.html.erb b/app/views/registrar/account/edit.html.erb
new file mode 100644
index 000000000..20aa88d2d
--- /dev/null
+++ b/app/views/registrar/account/edit.html.erb
@@ -0,0 +1,10 @@
+
+ - <%= link_to t('registrar.account.show.header'), registrar_account_path %>
+ - <%= t '.header' %>
+
+
+
+
+<%= render 'form' %>
\ No newline at end of file
diff --git a/app/views/registrar/account/show.html.erb b/app/views/registrar/account/show.html.erb
new file mode 100644
index 000000000..53218d1f7
--- /dev/null
+++ b/app/views/registrar/account/show.html.erb
@@ -0,0 +1,15 @@
+
+
+
+
+ <%= render 'details', registrar: current_registrar_user.registrar %>
+
+
+
+
+
+ <%= render 'linked_users', linked_users: current_registrar_user.linked_users %>
+
+
\ No newline at end of file
diff --git a/app/views/registrar/base/_current_user.html.erb b/app/views/registrar/base/_current_user.html.erb
index 0e45c9c7d..a21792b3c 100644
--- a/app/views/registrar/base/_current_user.html.erb
+++ b/app/views/registrar/base/_current_user.html.erb
@@ -1,5 +1,4 @@
<% current_user_presenter = UserPresenter.new(user: current_registrar_user, view: self) %>
-<%= link_to current_user_presenter.login_with_role, registrar_profile_path, id: 'registrar-profile-btn',
- class: 'navbar-link' %>
+<%= link_to current_user_presenter.login_with_role, registrar_account_path, class: 'navbar-link' %>
|
<%= link_to t('.sign_out'), destroy_registrar_user_session_path, method: :delete, class: 'navbar-link' %>
diff --git a/app/views/registrar/profile/show.html.erb b/app/views/registrar/profile/show.html.erb
deleted file mode 100644
index d6a90d64c..000000000
--- a/app/views/registrar/profile/show.html.erb
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
- <%= render 'linked_users', linked_users: linked_users %>
-
-
diff --git a/config/locales/registrar/account.en.yml b/config/locales/registrar/account.en.yml
new file mode 100644
index 000000000..94d4783d5
--- /dev/null
+++ b/config/locales/registrar/account.en.yml
@@ -0,0 +1,22 @@
+en:
+ registrar:
+ account:
+ show:
+ header: Your account
+
+ edit:
+ header: Edit your account
+
+ form:
+ submit_btn: Save changes
+
+ update:
+ saved: Your account has been updated
+
+ details:
+ header: Details
+ edit_btn: Edit
+
+ linked_users:
+ header: Linked users
+ switch_btn: Switch
diff --git a/config/locales/registrar/profile.en.yml b/config/locales/registrar/profile.en.yml
deleted file mode 100644
index 2ccec1406..000000000
--- a/config/locales/registrar/profile.en.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-en:
- registrar:
- profile:
- show:
- header: My profile
-
- linked_users:
- header: Linked users
- switch_btn: Switch
diff --git a/config/routes.rb b/config/routes.rb
index 0f093d45b..216946a08 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -66,7 +66,7 @@ Rails.application.routes.draw do
resources :account_activities
put 'current_user/switch/:new_user_id', to: 'current_user#switch', as: :switch_current_user
- resource :profile, controller: :profile, only: :show
+ resource :account, controller: :account, only: %i[show edit update]
resources :domains do
collection do
diff --git a/spec/features/registrar/linked_users_spec.rb b/spec/features/registrar/linked_users_spec.rb
index f7731a168..aa1e3785b 100644
--- a/spec/features/registrar/linked_users_spec.rb
+++ b/spec/features/registrar/linked_users_spec.rb
@@ -10,7 +10,7 @@ RSpec.feature 'Registrar area linked users', settings: false do
end
scenario 'switches current user to a linked one' do
- visit registrar_profile_path
+ visit registrar_account_path
click_link_or_button 'switch-current-user-2-btn'
expect(page).to have_text('You are now signed in as a user "new-user-name"')
end
diff --git a/spec/features/registrar/profile_spec.rb b/spec/features/registrar/profile_spec.rb
deleted file mode 100644
index 745542b58..000000000
--- a/spec/features/registrar/profile_spec.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require 'rails_helper'
-
-RSpec.feature 'Registrar area profile', settings: false do
- background do
- sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance))
- end
-
- scenario 'shows profile' do
- visit registrar_root_path
- click_on 'registrar-profile-btn'
- expect(page).to have_text(t('registrar.profile.show.header'))
- end
-end
diff --git a/test/system/registrar_area/account_test.rb b/test/system/registrar_area/account_test.rb
new file mode 100644
index 000000000..438de2629
--- /dev/null
+++ b/test/system/registrar_area/account_test.rb
@@ -0,0 +1,22 @@
+require 'test_helper'
+
+class RegistrarAccountTest < ApplicationSystemTestCase
+ setup do
+ @registrar = registrars(:bestnames)
+ sign_in users(:api_bestnames)
+ end
+
+ def test_updates_account
+ new_billing_email = 'new@registrar.test'
+ assert_not_equal new_billing_email, @registrar.billing_email
+
+ visit registrar_account_path
+ click_on 'Edit'
+
+ fill_in 'Billing email', with: new_billing_email
+ click_on 'Save changes'
+
+ assert_text 'Your account has been updated'
+ assert_text new_billing_email
+ end
+end
\ No newline at end of file
diff --git a/test/system/registrar_area/sign_in/password_test.rb b/test/system/registrar_area/sign_in/password_test.rb
index 04dffd07b..433c56d9d 100644
--- a/test/system/registrar_area/sign_in/password_test.rb
+++ b/test/system/registrar_area/sign_in/password_test.rb
@@ -17,10 +17,10 @@ class RegistrarAreaPasswordSignInTest < ApplicationSystemTestCase
assert_current_path registrar_root_path
end
- def test_after_successful_sign_in_billing_user_sees_profile
+ def test_after_successful_sign_in_billing_user_sees_account
@user.update!(roles: [ApiUser::BILLING])
login_with_correct_credentials
- assert_current_path registrar_profile_path
+ assert_current_path registrar_account_path
end
def test_wrong_password