示例#1
0
文件: login.go 项目: tangseng/gtt
func CheckAdmin(name, pass string) (*models.Person, error) {
	bm := beego.AppConfig.String("bm")
	admin := beego.AppConfig.String("admin")
	adminPass := beego.AppConfig.String("pass")
	if name == admin && models.MD5(pass, bm) == adminPass {
		person := models.NewPerson("管理员", "admin", "***", "", "")
		person.Id = -1
		return person, nil
	}
	return nil, errors.New("不是管理员")
}
示例#2
0
文件: login.go 项目: tangseng/gtt
func (this *LoginController) Md5() {
	val := this.GetString("val")
	this.Ctx.Output.Body([]byte(models.MD5(val, beego.AppConfig.String("bm"))))
}