1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-21 12:44:49 -05:00

#2154 disable change user for non-local users

- #2153 remove require for gravatar
This commit is contained in:
Unknwon 2015-12-11 15:31:02 -05:00
parent 5d95ffe3eb
commit d0b0d24f22
8 changed files with 18 additions and 10 deletions

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 |
|:-------------:|:-------:|:-------:|

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

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())

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 {

File diff suppressed because one or more lines are too long

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

View file

@ -1 +1 @@
0.7.42.1211 Beta
0.7.43.1211 Beta

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>