Skip to content

Commit beb6bf4

Browse files
authored
Remove obsolete change of email on profile page (#13341)
* Remove obsolete change of email on profile page The change email on the account profile page is out-of-date and unnecessary. Changing email should be done using the account page. Fix #13336 Signed-off-by: Andrew Thornton <[email protected]>
1 parent b64978d commit beb6bf4

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

integrations/auth_ldap_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func TestLDAPUserSignin(t *testing.T) {
141141

142142
assert.Equal(t, u.UserName, htmlDoc.GetInputValueByName("name"))
143143
assert.Equal(t, u.FullName, htmlDoc.GetInputValueByName("full_name"))
144-
assert.Equal(t, u.Email, htmlDoc.GetInputValueByName("email"))
144+
assert.Equal(t, u.Email, htmlDoc.Find(`label[for="email"]`).Siblings().First().Text())
145145
}
146146

147147
func TestLDAPUserSync(t *testing.T) {

integrations/html_helper.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ func (doc *HTMLDoc) GetInputValueByName(name string) string {
3737
return text
3838
}
3939

40+
// Find gets the descendants of each element in the current set of
41+
// matched elements, filtered by a selector. It returns a new Selection
42+
// object containing these matched elements.
43+
func (doc *HTMLDoc) Find(selector string) *goquery.Selection {
44+
return doc.doc.Find(selector)
45+
}
46+
4047
// GetCSRF for get CSRC token value from input
4148
func (doc *HTMLDoc) GetCSRF() string {
4249
return doc.GetInputValueByName("_csrf")

modules/auth/user_form.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ func (f *AccessTokenForm) Validate(ctx *macaron.Context, errs binding.Errors) bi
199199
type UpdateProfileForm struct {
200200
Name string `binding:"AlphaDashDot;MaxSize(40)"`
201201
FullName string `binding:"MaxSize(100)"`
202-
Email string `binding:"Required;Email;MaxSize(254)"`
203202
KeepEmailPrivate bool
204203
Website string `binding:"ValidUrl;MaxSize(255)"`
205204
Location string `binding:"MaxSize(50)"`

routers/user/setting/profile.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ func ProfilePost(ctx *context.Context, form auth.UpdateProfileForm) {
9191
}
9292

9393
ctx.User.FullName = form.FullName
94-
ctx.User.Email = form.Email
9594
ctx.User.KeepEmailPrivate = form.KeepEmailPrivate
9695
ctx.User.Website = form.Website
9796
ctx.User.Location = form.Location

templates/user/settings/profile.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
<label for="full_name">{{.i18n.Tr "settings.full_name"}}</label>
2222
<input id="full_name" name="full_name" value="{{.SignedUser.FullName}}">
2323
</div>
24-
<div class="required field {{if .Err_Email}}error{{end}}">
24+
<div class="field {{if .Err_Email}}error{{end}}">
2525
<label for="email">{{.i18n.Tr "email"}}</label>
26-
<input id="email" name="email" value="{{.SignedUser.Email}}">
26+
<p>{{.SignedUser.Email}}</p>
2727
</div>
2828
<div class="inline field">
2929
<div class="ui checkbox" id="keep-email-private">

0 commit comments

Comments
 (0)