Skip to content

Commit 582852f

Browse files
zeripathtechknowlogick
authored andcommitted
Remove obsolete change of email on profile page (go-gitea#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 go-gitea#13336 Signed-off-by: Andrew Thornton <[email protected]>
1 parent e6723ef commit 582852f

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
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: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ func (f *AccessTokenForm) Validate(ctx *macaron.Context, errs binding.Errors) bi
196196

197197
// UpdateProfileForm form for updating profile
198198
type UpdateProfileForm struct {
199-
Name string `binding:"AlphaDashDot;MaxSize(40)"`
200-
FullName string `binding:"MaxSize(100)"`
201-
Email string `binding:"Required;Email;MaxSize(254)"`
202-
KeepEmailPrivate bool
203-
Website string `binding:"ValidUrl;MaxSize(255)"`
204-
Location string `binding:"MaxSize(50)"`
205-
Language string `binding:"Size(5)"`
206-
Description string `binding:"MaxSize(255)"`
199+
Name string `binding:"AlphaDashDot;MaxSize(40)"`
200+
FullName string `binding:"MaxSize(100)"`
201+
KeepEmailPrivate bool
202+
Website string `binding:"ValidUrl;MaxSize(255)"`
203+
Location string `binding:"MaxSize(50)"`
204+
Language string `binding:"Size(5)"`
205+
Description string `binding:"MaxSize(255)"`
206+
KeepActivityPrivate bool
207207
}
208208

209209
// Validate validates the fields

routers/user/setting/profile.go

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

9292
ctx.User.FullName = form.FullName
93-
ctx.User.Email = form.Email
9493
ctx.User.KeepEmailPrivate = form.KeepEmailPrivate
9594
ctx.User.Website = form.Website
9695
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)