]> source.dussan.org Git - gitea.git/commitdiff
Remove obsolete change of email on profile page (#13341) (#13347)
authortechknowlogick <techknowlogick@gitea.io>
Thu, 29 Oct 2020 06:44:45 +0000 (02:44 -0400)
committerGitHub <noreply@github.com>
Thu, 29 Oct 2020 06:44:45 +0000 (02:44 -0400)
* 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 <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
integrations/auth_ldap_test.go
integrations/html_helper.go
modules/auth/user_form.go
routers/user/setting/profile.go
templates/user/settings/profile.tmpl

index 520a611eab136541a302af1d87279b80900cb3cb..15694584186d0fd2ea7c7898ef353c9ae7bc4129 100644 (file)
@@ -141,7 +141,7 @@ func TestLDAPUserSignin(t *testing.T) {
 
        assert.Equal(t, u.UserName, htmlDoc.GetInputValueByName("name"))
        assert.Equal(t, u.FullName, htmlDoc.GetInputValueByName("full_name"))
-       assert.Equal(t, u.Email, htmlDoc.GetInputValueByName("email"))
+       assert.Equal(t, u.Email, htmlDoc.Find(`label[for="email"]`).Siblings().First().Text())
 }
 
 func TestLDAPUserSync(t *testing.T) {
index 823ed4485153258ab1d2d19e1ca99876cb80a229..6dc806a76ed267e1cc2023a7db9c0f218d60990c 100644 (file)
@@ -37,6 +37,13 @@ func (doc *HTMLDoc) GetInputValueByName(name string) string {
        return text
 }
 
+// Find gets the descendants of each element in the current set of
+// matched elements, filtered by a selector. It returns a new Selection
+// object containing these matched elements.
+func (doc *HTMLDoc) Find(selector string) *goquery.Selection {
+       return doc.doc.Find(selector)
+}
+
 // GetCSRF for get CSRC token value from input
 func (doc *HTMLDoc) GetCSRF() string {
        return doc.GetInputValueByName("_csrf")
index e657f78e6de4703376843870e77d35c442c4f61b..32fde1570ead2cd5d506f94fb5574d3edf638550 100644 (file)
@@ -199,7 +199,6 @@ func (f *AccessTokenForm) Validate(ctx *macaron.Context, errs binding.Errors) bi
 type UpdateProfileForm struct {
        Name                string `binding:"AlphaDashDot;MaxSize(40)"`
        FullName            string `binding:"MaxSize(100)"`
-       Email               string `binding:"Required;Email;MaxSize(254)"`
        KeepEmailPrivate    bool
        Website             string `binding:"ValidUrl;MaxSize(255)"`
        Location            string `binding:"MaxSize(50)"`
index edb78031f2b3419942540fc605eb0c10acfa510b..6653230a394295cc9db2ca483e2e4a65c8e6e382 100644 (file)
@@ -91,7 +91,6 @@ func ProfilePost(ctx *context.Context, form auth.UpdateProfileForm) {
        }
 
        ctx.User.FullName = form.FullName
-       ctx.User.Email = form.Email
        ctx.User.KeepEmailPrivate = form.KeepEmailPrivate
        ctx.User.Website = form.Website
        ctx.User.Location = form.Location
index 1f34e24585d6d169320c002f8a121a1877d6b84c..ea895ecd894f91e98e9b898fe329f0def4e0d300 100644 (file)
@@ -21,9 +21,9 @@
                                        <label for="full_name">{{.i18n.Tr "settings.full_name"}}</label>
                                        <input id="full_name" name="full_name" value="{{.SignedUser.FullName}}">
                                </div>
-                               <div class="required field {{if .Err_Email}}error{{end}}">
+                               <div class="field {{if .Err_Email}}error{{end}}">
                                        <label for="email">{{.i18n.Tr "email"}}</label>
-                                       <input id="email" name="email" value="{{.SignedUser.Email}}">
+                                       <p>{{.SignedUser.Email}}</p>
                                </div>
                                <div class="inline field">
                                        <div class="ui checkbox" id="keep-email-private">