Exemplo n.º 1
0
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)
}
Exemplo n.º 2
0
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)
}
Exemplo n.º 3
0
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)
}
Exemplo n.º 4
0
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)
}
Exemplo n.º 5
0
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)
}
Exemplo n.º 6
0
Arquivo: auths.go Projeto: 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)
}