Skip to content
Snippets Groups Projects
Commit ba65f291 authored by Jaakko Kantojärvi's avatar Jaakko Kantojärvi
Browse files

Add option to disable username changing

This option allows to disable users from changing their username.

This is very usefull in environments using strong internal authentication methods like ldap, pam or shibboleth.

You can allow users to change theyr username in these environments, but then new users (users loging in first time) is blocked from gitlab is her username exists.
parent 04186e97
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -51,7 +51,9 @@ class ProfilesController < ApplicationController
end
 
def update_username
if @user.can_change_username?
@user.update_attributes(username: params[:user][:username])
end
 
respond_to do |format|
format.js
Loading
Loading
Loading
Loading
@@ -234,6 +234,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,6 +53,7 @@
 
 
 
- if current_user.can_change_username?
%fieldset.update-username
%legend
Username
Loading
Loading
Loading
Loading
@@ -35,6 +35,7 @@ production: &base
## 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
@@ -57,6 +57,7 @@ Settings.gitlab['support_email'] ||= Settings.gitlab.email_from
Settings.gitlab['url'] ||= Settings.send(:build_gitlab_url)
Settings.gitlab['user'] ||= 'git'
Settings.gitlab['signup_enabled'] ||= false
Settings.gitlab['username_changing_enabled'] = true if Settings.gitlab['username_changing_enabled'].nil?
 
#
# Gravatar
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment