Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/profiles')
-rw-r--r--app/controllers/profiles/accounts_controller.rb13
-rw-r--r--app/controllers/profiles/avatars_controller.rb13
-rw-r--r--app/controllers/profiles/emails_controller.rb37
-rw-r--r--app/controllers/profiles/keys_controller.rb61
-rw-r--r--app/controllers/profiles/notifications_controller.rb44
-rw-r--r--app/controllers/profiles/passwords_controller.rb88
6 files changed, 0 insertions, 256 deletions
diff --git a/app/controllers/profiles/accounts_controller.rb b/app/controllers/profiles/accounts_controller.rb
deleted file mode 100644
index 9bd34fe2261..00000000000
--- a/app/controllers/profiles/accounts_controller.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class Profiles::AccountsController < ApplicationController
- layout "profile"
-
- def show
- @user = current_user
- end
-
- def unlink
- provider = params[:provider]
- current_user.identities.find_by(provider: provider).destroy
- redirect_to profile_account_path
- end
-end
diff --git a/app/controllers/profiles/avatars_controller.rb b/app/controllers/profiles/avatars_controller.rb
deleted file mode 100644
index 57f3bbf0627..00000000000
--- a/app/controllers/profiles/avatars_controller.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-class Profiles::AvatarsController < ApplicationController
- layout "profile"
-
- def destroy
- @user = current_user
- @user.remove_avatar!
-
- @user.save
- @user.reset_events_cache
-
- redirect_to profile_path
- end
-end
diff --git a/app/controllers/profiles/emails_controller.rb b/app/controllers/profiles/emails_controller.rb
deleted file mode 100644
index 954c98c0d9f..00000000000
--- a/app/controllers/profiles/emails_controller.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-class Profiles::EmailsController < ApplicationController
- layout "profile"
-
- def index
- @primary = current_user.email
- @public_email = current_user.public_email
- @emails = current_user.emails
- end
-
- def create
- @email = current_user.emails.new(email_params)
-
- flash[:alert] = @email.errors.full_messages.first unless @email.save
-
- redirect_to profile_emails_url
- end
-
- def destroy
- @email = current_user.emails.find(params[:id])
- @email.destroy
-
- current_user.set_notification_email
- current_user.set_public_email
- current_user.save if current_user.notification_email_changed? or current_user.public_email_changed?
-
- respond_to do |format|
- format.html { redirect_to profile_emails_url }
- format.js { render nothing: true }
- end
- end
-
- private
-
- def email_params
- params.require(:email).permit(:email)
- end
-end
diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb
deleted file mode 100644
index 4e2bd0a9b4b..00000000000
--- a/app/controllers/profiles/keys_controller.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-class Profiles::KeysController < ApplicationController
- layout "profile"
- skip_before_filter :authenticate_user!, only: [:get_keys]
-
- def index
- @keys = current_user.keys
- end
-
- def show
- @key = current_user.keys.find(params[:id])
- end
-
- def new
- @key = current_user.keys.new
- end
-
- def create
- @key = current_user.keys.new(key_params)
-
- if @key.save
- redirect_to profile_key_path(@key)
- else
- render 'new'
- end
- end
-
- def destroy
- @key = current_user.keys.find(params[:id])
- @key.destroy
-
- respond_to do |format|
- format.html { redirect_to profile_keys_url }
- format.js { render nothing: true }
- end
- end
-
- # Get all keys of a user(params[:username]) in a text format
- # Helpful for sysadmins to put in respective servers
- def get_keys
- if params[:username].present?
- begin
- user = User.find_by_username(params[:username])
- if user.present?
- render text: user.all_ssh_keys.join("\n"), content_type: "text/plain"
- else
- render_404 and return
- end
- rescue => e
- render text: e.message
- end
- else
- render_404 and return
- end
- end
-
- private
-
- def key_params
- params.require(:key).permit(:title, :key)
- end
-end
diff --git a/app/controllers/profiles/notifications_controller.rb b/app/controllers/profiles/notifications_controller.rb
deleted file mode 100644
index 3fdcbbab61b..00000000000
--- a/app/controllers/profiles/notifications_controller.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-class Profiles::NotificationsController < ApplicationController
- layout 'profile'
-
- def show
- @user = current_user
- @notification = current_user.notification
- @project_members = current_user.project_members
- @group_members = current_user.group_members
- end
-
- def update
- type = params[:notification_type]
-
- @saved = if type == 'global'
- current_user.update_attributes(user_params)
- elsif type == 'group'
- group_member = current_user.group_members.find(params[:notification_id])
- group_member.notification_level = params[:notification_level]
- group_member.save
- else
- project_member = current_user.project_members.find(params[:notification_id])
- project_member.notification_level = params[:notification_level]
- project_member.save
- end
-
- respond_to do |format|
- format.html do
- if @saved
- flash[:notice] = "Notification settings saved"
- else
- flash[:alert] = "Failed to save new settings"
- end
-
- redirect_to :back
- end
-
- format.js
- end
- end
-
- def user_params
- params.require(:user).permit(:notification_email, :notification_level)
- end
-end
diff --git a/app/controllers/profiles/passwords_controller.rb b/app/controllers/profiles/passwords_controller.rb
deleted file mode 100644
index 0c614969a3f..00000000000
--- a/app/controllers/profiles/passwords_controller.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-class Profiles::PasswordsController < ApplicationController
- layout :determine_layout
-
- skip_before_filter :check_password_expiration, only: [:new, :create]
-
- before_filter :set_user
- before_filter :set_title
- before_filter :authorize_change_password!
-
- def new
- end
-
- 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'
- return
- end
-
- new_password = user_params[:password]
- new_password_confirmation = user_params[:password_confirmation]
-
- result = @user.update_attributes(
- password: new_password,
- password_confirmation: new_password_confirmation,
- password_automatically_set: false
- )
-
- if result
- @user.update_attributes(password_expires_at: nil)
- redirect_to root_path, notice: 'Password successfully changed'
- else
- render :new
- end
- end
-
- def edit
- end
-
- def update
- password_attributes = user_params.select do |key, value|
- %w(password password_confirmation).include?(key.to_s)
- end
- 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'
- return
- end
-
- if @user.update_attributes(password_attributes)
- flash[:notice] = "Password was successfully updated. Please login with it"
- redirect_to new_user_session_path
- else
- render 'edit'
- end
- end
-
- def reset
- current_user.send_reset_password_instructions
- redirect_to edit_profile_password_path, notice: 'We sent you an email with reset password instructions'
- end
-
- private
-
- def set_user
- @user = current_user
- end
-
- def set_title
- @title = "New password"
- end
-
- def determine_layout
- if [:new, :create].include?(action_name.to_sym)
- 'navless'
- else
- 'profile'
- end
- end
-
- def authorize_change_password!
- return render_404 if @user.ldap_user?
- end
-
- def user_params
- params.require(:user).permit(:current_password, :password, :password_confirmation)
- end
-end