-
Notifications
You must be signed in to change notification settings - Fork 0
/
route.go
49 lines (40 loc) · 1.13 KB
/
route.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package gautu
import (
"net/http"
"github.com/gin-gonic/gin"
)
func (gs *GautuServer) Router() {
router(gs)
}
func router(gs *GautuServer) {
homeMain := Home(gs.router)
gs.router.LoadHTMLGlob("templates/*")
homeMain.Any("/", func(c *gin.Context) {
c.Redirect(http.StatusMovedPermanently, "login")
})
homeMain.GET("/login", loginGet)
homeMain.POST("/login", loginPost)
homeMain.GET("/register", registerGet)
homeMain.POST("/register", registerPost)
homeMain.GET("/forget", forgetGet)
homeMain.POST("/forget", forgetPost)
homeMain.GET("/reset", resetGet)
//homeMain.GET("/token", tokenGet)
homeMain.POST("/token", tokenPost)
homeMain.GET("/userinfo", userinfoGet)
homeMain.POST("/msg/send", registerPhoneSend)
homeMain.POST("/msg/check", registerPhoneCheck)
oauth := homeMain.Group("/")
oauth.Use(SignCheck)
oauth.GET("/logout", logout)
oauth.GET("/authorize", authorizeGet)
oauth.POST("/authorize", authorizePost)
oauth.GET("/change", changeGet)
oauth.POST("/change", changePost)
oauth.GET("/home", home)
}
func Home(e *gin.Engine) *gin.RouterGroup {
homeMain := e.Group("/")
homeMain.Use(VisitLog)
return homeMain
}