Browse Source

#2154 disable change user for non-local users

- #2153 remove require for gravatar
for-closed-social
Unknwon 9 years ago
parent
commit
d0b0d24f22
8 changed files with 18 additions and 10 deletions
  1. +1
    -1
      README.md
  2. +1
    -0
      conf/locale/locale_en-US.ini
  3. +1
    -1
      gogs.go
  4. +1
    -1
      modules/auth/user_form.go
  5. +2
    -2
      modules/bindata/bindata.go
  6. +4
    -2
      routers/user/setting.go
  7. +1
    -1
      templates/.VERSION
  8. +7
    -2
      templates/user/settings/profile.tmpl

+ 1
- 1
README.md View File

@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
##### Current version: 0.7.42 Beta
##### Current version: 0.7.43 Beta
| Web | UI | Preview |
|:-------------:|:-------:|:-------:|

+ 1
- 0
conf/locale/locale_en-US.ini View File

@ -248,6 +248,7 @@ uid = Uid
public_profile = Public Profile
profile_desc = Your email address is public and will be used for any account related notifications, and any web based operations made via the site.
password_username_disabled = Non-local type users are not allowed to change their username.
full_name = Full Name
website = Website
location = Location

+ 1
- 1
gogs.go View File

@ -18,7 +18,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
const APP_VER = "0.7.42.1211 Beta"
const APP_VER = "0.7.43.1211 Beta"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())

+ 1
- 1
modules/auth/user_form.go View File

@ -92,7 +92,7 @@ type UpdateProfileForm struct {
Email string `binding:"Required;Email;MaxSize(254)"`
Website string `binding:"Url;MaxSize(100)"`
Location string `binding:"MaxSize(50)"`
Gravatar string `binding:"Required;Email;MaxSize(254)"`
Gravatar string `binding:"OmitEmpty;Email;MaxSize(254)"`
}
func (f *UpdateProfileForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {

+ 2
- 2
modules/bindata/bindata.go
File diff suppressed because it is too large
View File


+ 4
- 2
routers/user/setting.go View File

@ -79,8 +79,10 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateProfileForm) {
ctx.User.Email = form.Email
ctx.User.Website = form.Website
ctx.User.Location = form.Location
ctx.User.Avatar = base.EncodeMD5(form.Gravatar)
ctx.User.AvatarEmail = form.Gravatar
if len(form.Gravatar) > 0 {
ctx.User.Avatar = base.EncodeMD5(form.Gravatar)
ctx.User.AvatarEmail = form.Gravatar
}
if err := models.UpdateUser(ctx.User); err != nil {
ctx.Handle(500, "UpdateUser", err)
return

+ 1
- 1
templates/.VERSION View File

@ -1 +1 @@
0.7.42.1211 Beta
0.7.43.1211 Beta

+ 7
- 2
templates/user/settings/profile.tmpl View File

@ -14,7 +14,10 @@
{{.CsrfTokenHtml}}
<div class="required field {{if .Err_Name}}error{{end}}">
<label for="username">{{.i18n.Tr "username"}}<span class="text red hide" id="name-change-prompt"> {{.i18n.Tr "settings.change_username_prompt"}}</span></label>
<input id="username" name="name" value="{{.SignedUser.Name}}" data-name="{{.SignedUser.Name}}" autofocus required>
<input id="username" name="name" value="{{.SignedUser.Name}}" data-name="{{.SignedUser.Name}}" autofocus required {{if not .SignedUser.IsLocal}}disabled{{end}}>
{{if not .SignedUser.IsLocal}}
<p class="help text blue">{{$.i18n.Tr "settings.password_username_disabled"}}</p>
{{end}}
</div>
<div class="field {{if .Err_FullName}}error{{end}}">
<label for="full_name">{{.i18n.Tr "settings.full_name"}}</label>
@ -32,10 +35,12 @@
<label for="location">{{.i18n.Tr "settings.location"}}</label>
<input id="location" name="location" value="{{.SignedUser.Location}}">
</div>
<div class="required field {{if or DisableGravatar .SignedUser.UseCustomAvatar}}hide{{end}} {{if .Err_Gravatar}}error{{end}}">
{{if not DisableGravatar}}
<div class="field {{if .Err_Gravatar}}error{{end}}">
<label for="gravatar">Gravatar {{.i18n.Tr "email"}}</label>
<input id="gravatar" name="gravatar" value="{{.SignedUser.AvatarEmail}}" />
</div>
{{end}}
<div class="field">
<button class="ui green button">{{$.i18n.Tr "settings.update_profile"}}</button>

Loading…
Cancel
Save