summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-06-25 00:44:48 -0400
committerUnknown <joe2010xtmf@163.com>2014-06-25 00:44:48 -0400
commite0f9c628c5ff7399167944b3d0730698487af498 (patch)
treecb296196a29b713d4aa224a296e5088021e6b777 /routers/user
parentb2801a2e985f11e940a0cd420cea57242ea26d4c (diff)
downloadgitea-e0f9c628c5ff7399167944b3d0730698487af498.tar.gz
gitea-e0f9c628c5ff7399167944b3d0730698487af498.zip
Add create organization
Diffstat (limited to 'routers/user')
-rw-r--r--routers/user/home.go13
-rw-r--r--routers/user/user.go7
2 files changed, 14 insertions, 6 deletions
diff --git a/routers/user/home.go b/routers/user/home.go
index 0f2cee2565..86907b5a90 100644
--- a/routers/user/home.go
+++ b/routers/user/home.go
@@ -20,7 +20,7 @@ import (
const (
DASHBOARD base.TplName = "user/dashboard"
PROFILE base.TplName = "user/profile"
- ISSUES base.TplName = "user/issue"
+ ISSUES base.TplName = "user/issues"
PULLS base.TplName = "user/pulls"
STARS base.TplName = "user/stars"
)
@@ -29,6 +29,13 @@ func Dashboard(ctx *middleware.Context) {
ctx.Data["Title"] = "Dashboard"
ctx.Data["PageIsUserDashboard"] = true
+ if err := ctx.User.GetOrganizations(); err != nil {
+ ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
+ return
+ }
+ ctx.Data["Orgs"] = ctx.User.Orgs
+ ctx.Data["ContextUser"] = ctx.User
+
var err error
ctx.Data["MyRepos"], err = models.GetRepositories(ctx.User.Id, true)
if err != nil {
@@ -53,7 +60,7 @@ func Dashboard(ctx *middleware.Context) {
for _, act := range actions {
if act.IsPrivate {
if has, _ := models.HasAccess(ctx.User.Name, act.RepoUserName+"/"+act.RepoName,
- models.AU_READABLE); !has {
+ models.READABLE); !has {
continue
}
}
@@ -131,7 +138,7 @@ func Feeds(ctx *middleware.Context, form auth.FeedsForm) {
for _, act := range actions {
if act.IsPrivate {
if has, _ := models.HasAccess(ctx.User.Name, act.RepoUserName+"/"+act.RepoName,
- models.AU_READABLE); !has {
+ models.READABLE); !has {
continue
}
}
diff --git a/routers/user/user.go b/routers/user/user.go
index 8144730e09..a50f126c0c 100644
--- a/routers/user/user.go
+++ b/routers/user/user.go
@@ -226,7 +226,7 @@ func SignUpPost(ctx *middleware.Context, form auth.RegisterForm) {
}
var err error
- if u, err = models.RegisterUser(u); err != nil {
+ if u, err = models.CreateUser(u); err != nil {
switch err {
case models.ErrUserAlreadyExist:
ctx.Data["Err_UserName"] = true
@@ -235,13 +235,14 @@ func SignUpPost(ctx *middleware.Context, form auth.RegisterForm) {
ctx.Data["Err_Email"] = true
ctx.RenderWithErr("E-mail address has been already used", SIGNUP, &form)
case models.ErrUserNameIllegal:
+ ctx.Data["Err_UserName"] = true
ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), SIGNUP, &form)
default:
- ctx.Handle(500, "user.SignUpPost(RegisterUser)", err)
+ ctx.Handle(500, "user.SignUpPost(CreateUser)", err)
}
return
}
- log.Trace("%s User created: %s", ctx.Req.RequestURI, form.UserName)
+ log.Trace("%s User created: %s", ctx.Req.RequestURI, u.Name)
// Bind social account.
if isOauth {