mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-14 23:39:45 +00:00
版本重构,加web管理方式
This commit is contained in:
27
controllers/login.go
Executable file
27
controllers/login.go
Executable file
@@ -0,0 +1,27 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
type LoginController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
func (self *LoginController) Index() {
|
||||
self.TplName = "login/index.html"
|
||||
}
|
||||
func (self *LoginController) Verify() {
|
||||
if self.GetString("psd") == beego.AppConfig.String("password") {
|
||||
self.SetSession("auth", true)
|
||||
self.Data["json"] = map[string]interface{}{"status": 1, "msg": "验证成功"}
|
||||
self.ServeJSON()
|
||||
} else {
|
||||
self.Data["json"] = map[string]interface{}{"status": 0, "msg": "验证失败"}
|
||||
self.ServeJSON()
|
||||
}
|
||||
}
|
||||
func (self *LoginController) Out() {
|
||||
self.SetSession("auth", false)
|
||||
self.Redirect("/login/index", 302)
|
||||
}
|
Reference in New Issue
Block a user