diff options
Diffstat (limited to 'app/controllers')
25 files changed, 63 insertions, 63 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1d55a073f3b..70d5c274526 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -284,7 +284,7 @@ class ApplicationController < ActionController::Base password_expires_at = current_user&.password_expires_at if password_expires_at && password_expires_at < Time.now - return redirect_to new_profile_password_path + return redirect_to new_settings_password_path end end @@ -341,7 +341,7 @@ class ApplicationController < ActionController::Base def require_email if current_user && current_user.temp_oauth_email? && session[:impersonator_id].nil? - return redirect_to profile_path, notice: _('Please complete your profile with email address') + return redirect_to settings_path, notice: _('Please complete your profile with email address') end end diff --git a/app/controllers/concerns/enforces_two_factor_authentication.rb b/app/controllers/concerns/enforces_two_factor_authentication.rb index 825181568ad..123068bc6e0 100644 --- a/app/controllers/concerns/enforces_two_factor_authentication.rb +++ b/app/controllers/concerns/enforces_two_factor_authentication.rb @@ -17,7 +17,7 @@ module EnforcesTwoFactorAuthentication def check_two_factor_requirement if two_factor_authentication_required? && current_user && !current_user.temp_oauth_email? && !current_user.two_factor_enabled? && !skip_two_factor? - redirect_to profile_two_factor_auth_path + redirect_to settings_two_factor_auth_path end end diff --git a/app/controllers/jwt_controller.rb b/app/controllers/jwt_controller.rb index 5ecf4f114cf..85811206346 100644 --- a/app/controllers/jwt_controller.rb +++ b/app/controllers/jwt_controller.rb @@ -41,7 +41,7 @@ class JwtController < ApplicationController { code: 'UNAUTHORIZED', message: _('HTTP Basic: Access denied\n' \ 'You must use a personal access token with \'api\' scope for Git over HTTP.\n' \ - 'You can generate one at %{profile_personal_access_tokens_url}') % { profile_personal_access_tokens_url: profile_personal_access_tokens_url } } + 'You can generate one at %{settings_personal_access_tokens_url}') % { profile_personal_access_tokens_url: profile_personal_access_tokens_url } } ] }, status: :unauthorized end diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb index ab4ca56bb49..c1ab18d2d98 100644 --- a/app/controllers/oauth/applications_controller.rb +++ b/app/controllers/oauth/applications_controller.rb @@ -37,7 +37,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController def verify_user_oauth_applications_enabled return if Gitlab::CurrentSettings.user_oauth_applications? - redirect_to profile_path + redirect_to settings_path end def set_index_vars diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index b1efa767154..cd4435761d7 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -110,11 +110,11 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController end def redirect_identity_link_failed(error_message) - redirect_to profile_account_path, notice: _("Authentication failed: %{error_message}") % { error_message: error_message } + redirect_to settings_account_path, notice: _("Authentication failed: %{error_message}") % { error_message: error_message } end def redirect_identity_linked - redirect_to profile_account_path, notice: _('Authentication method updated') + redirect_to settings_account_path, notice: _('Authentication method updated') end def handle_service_ticket(provider, ticket) diff --git a/app/controllers/profiles/application_controller.rb b/app/controllers/profiles/application_controller.rb deleted file mode 100644 index 52b046ef64f..00000000000 --- a/app/controllers/profiles/application_controller.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -class Profiles::ApplicationController < ApplicationController - layout 'profile' -end diff --git a/app/controllers/profiles/u2f_registrations_controller.rb b/app/controllers/profiles/u2f_registrations_controller.rb deleted file mode 100644 index 866c4dee6e2..00000000000 --- a/app/controllers/profiles/u2f_registrations_controller.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class Profiles::U2fRegistrationsController < Profiles::ApplicationController - def destroy - u2f_registration = current_user.u2f_registrations.find(params[:id]) - u2f_registration.destroy - redirect_to profile_two_factor_auth_path, status: 302, notice: _("Successfully deleted U2F device.") - end -end diff --git a/app/controllers/projects/git_http_client_controller.rb b/app/controllers/projects/git_http_client_controller.rb index 956093b972b..494111de3c0 100644 --- a/app/controllers/projects/git_http_client_controller.rb +++ b/app/controllers/projects/git_http_client_controller.rb @@ -85,7 +85,7 @@ class Projects::GitHttpClientController < Projects::ApplicationController def render_missing_personal_access_token render plain: "HTTP Basic: Access denied\n" \ "You must use a personal access token with 'read_repository' or 'write_repository' scope for Git over HTTP.\n" \ - "You can generate one at #{profile_personal_access_tokens_url}", + "You can generate one at #{settings_personal_access_tokens_url}", status: :unauthorized end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 638934694e0..b5e8be2ea49 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -30,7 +30,7 @@ class RegistrationsController < Devise::RegistrationsController session.try(:destroy) redirect_to new_user_session_path, status: 303, notice: s_('Profiles|Account scheduled for removal.') else - redirect_to profile_account_path, status: 303, alert: destroy_confirmation_failure_message + redirect_to settings_account_path, status: 303, alert: destroy_confirmation_failure_message end end diff --git a/app/controllers/profiles/accounts_controller.rb b/app/controllers/settings/accounts_controller.rb index b03f4b7435f..a3aa9857444 100644 --- a/app/controllers/profiles/accounts_controller.rb +++ b/app/controllers/settings/accounts_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::AccountsController < Profiles::ApplicationController +class Settings::AccountsController < Settings::ApplicationController include AuthHelper def show @@ -20,7 +20,7 @@ class Profiles::AccountsController < Profiles::ApplicationController flash[:alert] = _("You are not allowed to unlink your primary login account") end - redirect_to profile_account_path + redirect_to settings_account_path end # rubocop: enable CodeReuse/ActiveRecord diff --git a/app/controllers/profiles/active_sessions_controller.rb b/app/controllers/settings/active_sessions_controller.rb index c473023cacb..a6de8834ea2 100644 --- a/app/controllers/profiles/active_sessions_controller.rb +++ b/app/controllers/settings/active_sessions_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::ActiveSessionsController < Profiles::ApplicationController +class Settings::ActiveSessionsController < Settings::ApplicationController def index @sessions = ActiveSession.list(current_user).reject(&:is_impersonated) end diff --git a/app/controllers/settings/application_controller.rb b/app/controllers/settings/application_controller.rb new file mode 100644 index 00000000000..ae68d2e152e --- /dev/null +++ b/app/controllers/settings/application_controller.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class Settings::ApplicationController < ApplicationController + layout 'profile' +end diff --git a/app/controllers/profiles/avatars_controller.rb b/app/controllers/settings/avatars_controller.rb index 3378a09628c..47e6be88854 100644 --- a/app/controllers/profiles/avatars_controller.rb +++ b/app/controllers/settings/avatars_controller.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true -class Profiles::AvatarsController < Profiles::ApplicationController +class Settings::AvatarsController < Settings::ApplicationController def destroy @user = current_user Users::UpdateService.new(current_user, user: @user).execute { |user| user.remove_avatar! } - redirect_to profile_path, status: :found + redirect_to settings_path, status: :found end end diff --git a/app/controllers/profiles/chat_names_controller.rb b/app/controllers/settings/chat_names_controller.rb index 80b8279e91e..88d159f8dd9 100644 --- a/app/controllers/profiles/chat_names_controller.rb +++ b/app/controllers/settings/chat_names_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::ChatNamesController < Profiles::ApplicationController +class Settings::ChatNamesController < Settings::ApplicationController before_action :chat_name_token, only: [:new] before_action :chat_name_params, only: [:new, :create, :deny] @@ -21,7 +21,7 @@ class Profiles::ChatNamesController < Profiles::ApplicationController end delete_chat_name_token - redirect_to profile_chat_names_path + redirect_to settings_chat_names_path end def deny @@ -29,7 +29,7 @@ class Profiles::ChatNamesController < Profiles::ApplicationController flash[:notice] = _("Denied authorization of chat nickname %{user_name}.") % { user_name: chat_name_params[:user_name] } - redirect_to profile_chat_names_path + redirect_to settings_chat_names_path end def destroy @@ -41,7 +41,7 @@ class Profiles::ChatNamesController < Profiles::ApplicationController flash[:alert] = _("Could not delete chat nickname %{chat_name}.") % { chat_name: @chat_name.chat_name } end - redirect_to profile_chat_names_path, status: :found + redirect_to settings_chat_names_path, status: :found end private diff --git a/app/controllers/profiles/emails_controller.rb b/app/controllers/settings/emails_controller.rb index f666a1150a6..37c9780c3a6 100644 --- a/app/controllers/profiles/emails_controller.rb +++ b/app/controllers/settings/emails_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::EmailsController < Profiles::ApplicationController +class Settings::EmailsController < Settings::ApplicationController before_action :find_email, only: [:destroy, :resend_confirmation_instructions] def index @@ -14,14 +14,14 @@ class Profiles::EmailsController < Profiles::ApplicationController flash[:alert] = @email.errors.full_messages.first end - redirect_to profile_emails_url + redirect_to settings_emails_url end def destroy Emails::DestroyService.new(current_user, user: current_user).execute(@email) respond_to do |format| - format.html { redirect_to profile_emails_url, status: :found } + format.html { redirect_to settings_emails_url, status: :found } format.js { head :ok } end end @@ -33,7 +33,7 @@ class Profiles::EmailsController < Profiles::ApplicationController flash[:alert] = _("There was a problem sending the confirmation email") end - redirect_to profile_emails_url + redirect_to settings_emails_url end private diff --git a/app/controllers/profiles/gpg_keys_controller.rb b/app/controllers/settings/gpg_keys_controller.rb index 8c34a66c374..cc40aff4108 100644 --- a/app/controllers/profiles/gpg_keys_controller.rb +++ b/app/controllers/settings/gpg_keys_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::GpgKeysController < Profiles::ApplicationController +class Settings::GpgKeysController < Settings::ApplicationController before_action :set_gpg_key, only: [:destroy, :revoke] def index @@ -12,7 +12,7 @@ class Profiles::GpgKeysController < Profiles::ApplicationController @gpg_key = GpgKeys::CreateService.new(current_user, gpg_key_params).execute if @gpg_key.persisted? - redirect_to profile_gpg_keys_path + redirect_to settings_gpg_keys_path else @gpg_keys = current_user.gpg_keys.select(&:persisted?) render :index @@ -23,7 +23,7 @@ class Profiles::GpgKeysController < Profiles::ApplicationController @gpg_key.destroy respond_to do |format| - format.html { redirect_to profile_gpg_keys_url, status: :found } + format.html { redirect_to settings_gpg_keys_url, status: :found } format.js { head :ok } end end @@ -32,7 +32,7 @@ class Profiles::GpgKeysController < Profiles::ApplicationController @gpg_key.revoke respond_to do |format| - format.html { redirect_to profile_gpg_keys_url, status: :found } + format.html { redirect_to settings_gpg_keys_url, status: :found } format.js { head :ok } end end diff --git a/app/controllers/profiles/groups_controller.rb b/app/controllers/settings/groups_controller.rb index c755bcb718a..b16d1f8bf4b 100644 --- a/app/controllers/profiles/groups_controller.rb +++ b/app/controllers/settings/groups_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::GroupsController < Profiles::ApplicationController +class Settings::GroupsController < Settings::ApplicationController include RoutableActions def update @@ -13,7 +13,7 @@ class Profiles::GroupsController < Profiles::ApplicationController flash[:alert] = "Failed to save new settings for #{group.name}" end - redirect_back_or_default(default: profile_notifications_path) + redirect_back_or_default(default: settings_notifications_path) end private diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/settings/keys_controller.rb index 055d900eece..1eb70f6a58d 100644 --- a/app/controllers/profiles/keys_controller.rb +++ b/app/controllers/settings/keys_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::KeysController < Profiles::ApplicationController +class Settings::KeysController < Settings::ApplicationController skip_before_action :authenticate_user!, only: [:get_keys] def index @@ -16,7 +16,7 @@ class Profiles::KeysController < Profiles::ApplicationController @key = Keys::CreateService.new(current_user, key_params.merge(ip_address: request.remote_ip)).execute if @key.persisted? - redirect_to profile_key_path(@key) + redirect_to settings_key_path(@key) else @keys = current_user.keys.select(&:persisted?) render :index @@ -28,7 +28,7 @@ class Profiles::KeysController < Profiles::ApplicationController Keys::DestroyService.new(current_user).execute(@key) respond_to do |format| - format.html { redirect_to profile_keys_url, status: :found } + format.html { redirect_to settings_keys_url, status: :found } format.js { head :ok } end end diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/settings/notifications_controller.rb index 617e5bb7cb3..18a39800340 100644 --- a/app/controllers/profiles/notifications_controller.rb +++ b/app/controllers/settings/notifications_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::NotificationsController < Profiles::ApplicationController +class Settings::NotificationsController < Settings::ApplicationController # rubocop: disable CodeReuse/ActiveRecord def show @user = current_user @@ -19,7 +19,7 @@ class Profiles::NotificationsController < Profiles::ApplicationController flash[:alert] = _("Failed to save new settings") end - redirect_back_or_default(default: profile_notifications_path) + redirect_back_or_default(default: settings_notifications_path) end def user_params diff --git a/app/controllers/profiles/passwords_controller.rb b/app/controllers/settings/passwords_controller.rb index d2787c2e450..cc227cf4b9e 100644 --- a/app/controllers/profiles/passwords_controller.rb +++ b/app/controllers/settings/passwords_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::PasswordsController < Profiles::ApplicationController +class Settings::PasswordsController < Settings::ApplicationController skip_before_action :check_password_expiration, only: [:new, :create] skip_before_action :check_two_factor_requirement, only: [:new, :create] @@ -14,7 +14,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController def create unless @user.password_automatically_set || @user.valid_password?(user_params[:current_password]) - redirect_to new_profile_password_path, alert: _('You must provide a valid current password') + redirect_to new_settings_password_path, alert: _('You must provide a valid current password') return end @@ -45,7 +45,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController password_attributes[:password_automatically_set] = false unless @user.password_automatically_set || @user.valid_password?(user_params[:current_password]) - redirect_to edit_profile_password_path, alert: _('You must provide a valid current password') + redirect_to edit_settings_password_path, alert: _('You must provide a valid current password') return end @@ -62,7 +62,7 @@ class Profiles::PasswordsController < Profiles::ApplicationController def reset current_user.send_reset_password_instructions - redirect_to edit_profile_password_path, notice: _('We sent you an email with reset password instructions') + redirect_to edit_settings_password_path, notice: _('We sent you an email with reset password instructions') end private diff --git a/app/controllers/profiles/personal_access_tokens_controller.rb b/app/controllers/settings/personal_access_tokens_controller.rb index f1c07cd9a1d..a9cec61196e 100644 --- a/app/controllers/profiles/personal_access_tokens_controller.rb +++ b/app/controllers/settings/personal_access_tokens_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::PersonalAccessTokensController < Profiles::ApplicationController +class Settings::PersonalAccessTokensController < Settings::ApplicationController def index set_index_vars @personal_access_token = finder.build @@ -11,7 +11,7 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController if @personal_access_token.save PersonalAccessToken.redis_store!(current_user.id, @personal_access_token.token) - redirect_to profile_personal_access_tokens_path, notice: _("Your new personal access token has been created.") + redirect_to settings_personal_access_tokens_path, notice: _("Your new personal access token has been created.") else set_index_vars render :index @@ -27,7 +27,7 @@ class Profiles::PersonalAccessTokensController < Profiles::ApplicationController flash[:alert] = _("Could not revoke personal access token %{personal_access_token_name}.") % { personal_access_token_name: @personal_access_token.name } end - redirect_to profile_personal_access_tokens_path + redirect_to settings_personal_access_tokens_path end private diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index 62f98d9e549..25ec2a434a4 100644 --- a/app/controllers/profiles/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::PreferencesController < Profiles::ApplicationController +class Settings::PreferencesController < Settings::ApplicationController before_action :user def show @@ -21,7 +21,7 @@ class Profiles::PreferencesController < Profiles::ApplicationController end respond_to do |format| - format.html { redirect_to profile_preferences_path } + format.html { redirect_to settings_preferences_path } format.js end end diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/settings/two_factor_auths_controller.rb index 95b9344c551..214e1da182b 100644 --- a/app/controllers/profiles/two_factor_auths_controller.rb +++ b/app/controllers/settings/two_factor_auths_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Profiles::TwoFactorAuthsController < Profiles::ApplicationController +class Settings::TwoFactorAuthsController < Settings::ApplicationController skip_before_action :check_two_factor_requirement def show @@ -58,7 +58,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController if @u2f_registration.persisted? session.delete(:challenges) - redirect_to profile_two_factor_auth_path, notice: s_("Your U2F device was registered!") + redirect_to settings_two_factor_auth_path, notice: s_("Your U2F device was registered!") else @qr_code = build_qr_code setup_u2f_registration @@ -75,12 +75,12 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController def destroy current_user.disable_two_factor! - redirect_to profile_account_path, status: :found + redirect_to settings_account_path, status: :found end def skip if two_factor_grace_period_expired? - redirect_to new_profile_two_factor_auth_path, alert: s_('Cannot skip two factor authentication setup') + redirect_to new_settings_two_factor_auth_path, alert: s_('Cannot skip two factor authentication setup') else session[:skip_two_factor] = current_user.otp_grace_period_started_at + two_factor_grace_period.hours redirect_to root_path diff --git a/app/controllers/settings/u2f_registrations_controller.rb b/app/controllers/settings/u2f_registrations_controller.rb new file mode 100644 index 00000000000..92e12948dc4 --- /dev/null +++ b/app/controllers/settings/u2f_registrations_controller.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class Settings::U2fRegistrationsController < Settings::ApplicationController + def destroy + u2f_registration = current_user.u2f_registrations.find(params[:id]) + u2f_registration.destroy + redirect_to settings_two_factor_auth_path, status: 302, notice: _("Successfully deleted U2F device.") + end +end diff --git a/app/controllers/profiles_controller.rb b/app/controllers/settings_controller.rb index 1d16ddb1608..34e7093dd05 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/settings_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class ProfilesController < Profiles::ApplicationController +class SettingsController < Settings::ApplicationController include ActionView::Helpers::SanitizeHelper before_action :user @@ -33,7 +33,7 @@ class ProfilesController < Profiles::ApplicationController flash[:notice] = s_("Profiles|Incoming email token was successfully reset") - redirect_to profile_personal_access_tokens_path + redirect_to settings_personal_access_tokens_path end def reset_feed_token @@ -43,7 +43,7 @@ class ProfilesController < Profiles::ApplicationController flash[:notice] = s_('Profiles|Feed token was successfully reset') - redirect_to profile_personal_access_tokens_path + redirect_to settings_personal_access_tokens_path end # rubocop: disable CodeReuse/ActiveRecord |