summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--integrations/auth_ldap_test.go2
-rw-r--r--integrations/html_helper.go7
-rw-r--r--modules/auth/user_form.go1
-rw-r--r--routers/user/setting/profile.go1
-rw-r--r--templates/user/settings/profile.tmpl4
5 files changed, 10 insertions, 5 deletions
diff --git a/integrations/auth_ldap_test.go b/integrations/auth_ldap_test.go
index 520a611eab..1569458418 100644
--- a/integrations/auth_ldap_test.go
+++ b/integrations/auth_ldap_test.go
@@ -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) {
diff --git a/integrations/html_helper.go b/integrations/html_helper.go
index 823ed44851..6dc806a76e 100644
--- a/integrations/html_helper.go
+++ b/integrations/html_helper.go
@@ -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")
diff --git a/modules/auth/user_form.go b/modules/auth/user_form.go
index e657f78e6d..32fde1570e 100644
--- a/modules/auth/user_form.go
+++ b/modules/auth/user_form.go
@@ -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)"`
diff --git a/routers/user/setting/profile.go b/routers/user/setting/profile.go
index edb78031f2..6653230a39 100644
--- a/routers/user/setting/profile.go
+++ b/routers/user/setting/profile.go
@@ -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
diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl
index 1f34e24585..ea895ecd89 100644
--- a/templates/user/settings/profile.tmpl
+++ b/templates/user/settings/profile.tmpl
@@ -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">