aboutsummaryrefslogtreecommitdiffstats
path: root/routers/org
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-09-06 10:08:14 -0400
committerUnknwon <u@gogs.io>2015-09-06 10:08:14 -0400
commit80701d45bbe333f1bdef4673fae43df131b2222f (patch)
tree5aea48f87ac43997e3d9b60dacc2eb05877a408d /routers/org
parentaa67de910af6246a6dc9ad96c56f789e282e8403 (diff)
downloadgitea-80701d45bbe333f1bdef4673fae43df131b2222f.tar.gz
gitea-80701d45bbe333f1bdef4673fae43df131b2222f.zip
#1193 Make organization emails non-mandatory
Diffstat (limited to 'routers/org')
-rw-r--r--routers/org/org.go11
-rw-r--r--routers/org/setting.go10
2 files changed, 3 insertions, 18 deletions
diff --git a/routers/org/org.go b/routers/org/org.go
index ed4f2abdea..d1c1940cb9 100644
--- a/routers/org/org.go
+++ b/routers/org/org.go
@@ -59,25 +59,18 @@ func CreatePost(ctx *middleware.Context, form auth.CreateOrgForm) {
org := &models.User{
Name: form.OrgName,
- Email: form.Email,
IsActive: true,
Type: models.ORGANIZATION,
}
- var err error
- if err = models.CreateOrganization(org, ctx.User); err != nil {
+ if err := models.CreateOrganization(org, ctx.User); err != nil {
+ ctx.Data["Err_OrgName"] = true
switch {
case models.IsErrUserAlreadyExist(err):
- ctx.Data["Err_OrgName"] = true
ctx.RenderWithErr(ctx.Tr("form.org_name_been_taken"), CREATE, &form)
- case models.IsErrEmailAlreadyUsed(err):
- ctx.Data["Err_Email"] = true
- ctx.RenderWithErr(ctx.Tr("form.email_been_used"), CREATE, &form)
case models.IsErrNameReserved(err):
- ctx.Data["Err_OrgName"] = true
ctx.RenderWithErr(ctx.Tr("org.form.name_reserved", err.(models.ErrNameReserved).Name), CREATE, &form)
case models.IsErrNamePatternNotAllowed(err):
- ctx.Data["Err_OrgName"] = true
ctx.RenderWithErr(ctx.Tr("org.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), CREATE, &form)
default:
ctx.Handle(500, "CreateOrganization", err)
diff --git a/routers/org/setting.go b/routers/org/setting.go
index a15af26d43..a00840b616 100644
--- a/routers/org/setting.go
+++ b/routers/org/setting.go
@@ -61,19 +61,11 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) {
}
org.FullName = form.OrgFullName
- org.Email = form.Email
org.Description = form.Description
org.Website = form.Website
org.Location = form.Location
- org.Avatar = base.EncodeMd5(form.Avatar)
- org.AvatarEmail = form.Avatar
if err := models.UpdateUser(org); err != nil {
- if models.IsErrEmailAlreadyUsed(err) {
- ctx.Data["Err_Email"] = true
- ctx.RenderWithErr(ctx.Tr("form.email_been_used"), SETTINGS_OPTIONS, &form)
- } else {
- ctx.Handle(500, "UpdateUser", err)
- }
+ ctx.Handle(500, "UpdateUser", err)
return
}
log.Trace("Organization setting updated: %s", org.Name)