File tree 3 files changed +13
-1
lines changed
3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ var Admin struct {
13
13
DefaultEmailNotification string
14
14
UserDisabledFeatures container.Set [string ]
15
15
ExternalUserDisableFeatures container.Set [string ]
16
+ ExternalUserLockFullName bool
16
17
}
17
18
18
19
func loadAdminFrom (rootCfg ConfigProvider ) {
@@ -21,6 +22,7 @@ func loadAdminFrom(rootCfg ConfigProvider) {
21
22
Admin .DefaultEmailNotification = sec .Key ("DEFAULT_EMAIL_NOTIFICATIONS" ).MustString ("enabled" )
22
23
Admin .UserDisabledFeatures = container .SetOf (sec .Key ("USER_DISABLED_FEATURES" ).Strings ("," )... )
23
24
Admin .ExternalUserDisableFeatures = container .SetOf (sec .Key ("EXTERNAL_USER_DISABLE_FEATURES" ).Strings ("," )... ).Union (Admin .UserDisabledFeatures )
25
+ Admin .ExternalUserLockFullName = sec .Key ("EXTERNAL_USER_LOCK_FULLNAME" ).MustBool (false )
24
26
}
25
27
26
28
const (
Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ func Profile(ctx *context.Context) {
50
50
51
51
ctx .Data ["UserDisabledFeatures" ] = user_model .DisabledFeaturesWithLoginType (ctx .Doer )
52
52
53
+ ctx .Data ["ExternalUserLockFullName" ] = setting .Admin .ExternalUserLockFullName
54
+
53
55
ctx .HTML (http .StatusOK , tplSettingsProfile )
54
56
}
55
57
@@ -99,6 +101,11 @@ func ProfilePost(ctx *context.Context) {
99
101
Visibility : optional .Some (form .Visibility ),
100
102
KeepActivityPrivate : optional .Some (form .KeepActivityPrivate ),
101
103
}
104
+
105
+ if ! ctx .Doer .IsLocal () && setting .Admin .ExternalUserLockFullName {
106
+ opts .FullName = optional .None [string ]()
107
+ }
108
+
102
109
if err := user_service .UpdateUser (ctx , ctx .Doer , opts ); err != nil {
103
110
ctx .ServerError ("UpdateUser" , err )
104
111
return
Original file line number Diff line number Diff line change 19
19
</div>
20
20
<div class="field {{if .Err_FullName}}error{{end}}">
21
21
<label for="full_name">{{ctx.Locale.Tr "settings.full_name"}}</label>
22
- <input id="full_name" name="full_name" value="{{.SignedUser.FullName}}" maxlength="100">
22
+ <input id="full_name" name="full_name" value="{{.SignedUser.FullName}}" {{if and (not .SignedUser.IsLocal) .ExternalUserLockFullName}}disabled{{end}} maxlength="100">
23
+ {{if and (not .SignedUser.IsLocal) .ExternalUserLockFullName}}
24
+ <p class="help text blue">{{ctx.Locale.Tr "settings.password_full_name_disabled"}}</p>
25
+ {{end}}
23
26
</div>
24
27
<div class="field {{if .Err_Email}}error{{end}}">
25
28
<label>{{ctx.Locale.Tr "email"}}</label>
You can’t perform that action at this time.
0 commit comments