Skip to content
Snippets Groups Projects
Commit db958e59 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge pull request #2888 from raphendyr/username_changing_disabled

Add option to disable username changing
parents 2e8db0df fcffb4c3
No related branches found
No related tags found
2 merge requests!3014Fix 4.1 Installation Doc wording,!2983Fixed typo in gitlab.yml.example
Loading
Loading
@@ -51,7 +51,9 @@ class ProfilesController < ApplicationController
end
 
def update_username
@user.update_attributes(username: params[:user][:username])
if @user.can_change_username?
@user.update_attributes(username: params[:user][:username])
end
 
respond_to do |format|
format.js
Loading
Loading
Loading
Loading
@@ -215,6 +215,10 @@ class User < ActiveRecord::Base
keys.count == 0
end
 
def can_change_username?
Gitlab.config.gitlab.username_changing_enabled
end
def can_create_project?
projects_limit > personal_projects.count
end
Loading
Loading
Loading
Loading
@@ -53,28 +53,29 @@
 
 
 
%fieldset.update-username
%legend
Username
%small.cred.right
Changing your username can have unintended side effects!
= form_for @user, url: update_username_profile_path, method: :put, remote: true do |f|
.padded
= f.label :username
.input
= f.text_field :username, required: true
&nbsp;
%span.loading-gif.hide= image_tag "ajax_loader.gif"
%span.update-success.cgreen.hide
%i.icon-ok
Saved
%span.update-failed.cred.hide
%i.icon-remove
Failed
%ul.cred
%li It will change web url for personal projects.
%li It will change the git path to repositories for personal projects.
.input
= f.submit 'Save username', class: "btn save-btn"
- if current_user.can_change_username?
%fieldset.update-username
%legend
Username
%small.cred.right
Changing your username can have unintended side effects!
= form_for @user, url: update_username_profile_path, method: :put, remote: true do |f|
.padded
= f.label :username
.input
= f.text_field :username, required: true
&nbsp;
%span.loading-gif.hide= image_tag "ajax_loader.gif"
%span.update-success.cgreen.hide
%i.icon-ok
Saved
%span.update-failed.cred.hide
%i.icon-remove
Failed
%ul.cred
%li It will change web url for personal projects.
%li It will change the git path to repositories for personal projects.
.input
= f.submit 'Save username', class: "btn save-btn"
 
 
Loading
Loading
@@ -35,6 +35,7 @@ gitlab:
## Project settings
default_projects_limit: 10
# signup_enabled: true # default: false - Account passwords are not sent via the email if signup is enabled.
# username_changing_enabled: false # default: true - User can change her username/namespace
 
## Gravatar
gravatar:
Loading
Loading
Loading
Loading
@@ -53,6 +53,7 @@ Settings.gitlab['support_email'] ||= Settings.gitlab.email_from
Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
Settings.gitlab['user'] ||= 'gitlab'
Settings.gitlab['signup_enabled'] ||= false
Settings.gitlab['username_changing_enabled'] = true if Settings.gitlab['username_changing_enabled'].nil?
 
Settings['gravatar'] ||= Settingslogic.new({})
Settings.gravatar['enabled'] = true if Settings.gravatar['enabled'].nil?
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment