示例#1
0
文件: user.go 项目: JustStone/gogs
func EditUser(ctx *middleware.Context, params martini.Params) {
	ctx.Data["Title"] = "Edit Account"
	ctx.Data["PageIsUsers"] = true

	uid, err := base.StrTo(params["userid"]).Int()
	if err != nil {
		ctx.Handle(404, "admin.user.EditUser", err)
		return
	}

	u, err := models.GetUserById(int64(uid))
	if err != nil {
		ctx.Handle(500, "admin.user.EditUser(GetUserById)", err)
		return
	}

	ctx.Data["User"] = u
	auths, err := models.GetAuths()
	if err != nil {
		ctx.Handle(500, "admin.user.NewUser(GetAuths)", err)
		return
	}
	ctx.Data["LoginSources"] = auths
	ctx.HTML(200, USER_EDIT)
}
示例#2
0
文件: users.go 项目: wxiangbo/gogs
func EditUser(ctx *middleware.Context) {
	ctx.Data["Title"] = ctx.Tr("admin.users.edit_account")
	ctx.Data["PageIsAdmin"] = true
	ctx.Data["PageIsAdminUsers"] = true

	uid := com.StrTo(ctx.Params(":userid")).MustInt64()
	if uid == 0 {
		ctx.Handle(404, "EditUser", nil)
		return
	}

	u, err := models.GetUserById(uid)
	if err != nil {
		ctx.Handle(500, "GetUserById", err)
		return
	}

	ctx.Data["User"] = u
	auths, err := models.GetAuths()
	if err != nil {
		ctx.Handle(500, "GetAuths", err)
		return
	}
	ctx.Data["LoginSources"] = auths
	ctx.HTML(200, USER_EDIT)
}
示例#3
0
文件: user.go 项目: JustStone/gogs
func NewUser(ctx *middleware.Context) {
	ctx.Data["Title"] = "New Account"
	ctx.Data["PageIsUsers"] = true
	auths, err := models.GetAuths()
	if err != nil {
		ctx.Handle(500, "admin.user.NewUser(GetAuths)", err)
		return
	}
	ctx.Data["LoginSources"] = auths
	ctx.HTML(200, USER_NEW)
}
示例#4
0
文件: admin.go 项目: JustStone/gogs
func Auths(ctx *middleware.Context) {
	ctx.Data["Title"] = "Auth Sources"
	ctx.Data["PageIsAuths"] = true

	var err error
	ctx.Data["Sources"], err = models.GetAuths()
	if err != nil {
		ctx.Handle(500, "admin.Auths", err)
		return
	}
	ctx.HTML(200, AUTHS)
}
示例#5
0
文件: users.go 项目: wxiangbo/gogs
func NewUser(ctx *middleware.Context) {
	ctx.Data["Title"] = ctx.Tr("admin.users.new_account")
	ctx.Data["PageIsAdmin"] = true
	ctx.Data["PageIsAdminUsers"] = true

	auths, err := models.GetAuths()
	if err != nil {
		ctx.Handle(500, "GetAuths", err)
		return
	}
	ctx.Data["LoginSources"] = auths
	ctx.HTML(200, USER_NEW)
}
示例#6
0
文件: auths.go 项目: noikiy/gogs
func Authentications(ctx *middleware.Context) {
	ctx.Data["Title"] = ctx.Tr("admin.authentication")
	ctx.Data["PageIsAdmin"] = true
	ctx.Data["PageIsAdminAuthentications"] = true

	var err error
	ctx.Data["Sources"], err = models.GetAuths()
	if err != nil {
		ctx.Handle(500, "GetAuths", err)
		return
	}
	ctx.HTML(200, AUTHS)
}