MCPcopy Create free account
hub / github.com/RaymondCode/simple-demo / Login

Function Login

controller/user.go:60–77  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

58}
59
60func Login(c *gin.Context) {
61 username := c.Query("username")
62 password := c.Query("password")
63
64 token := username + password
65
66 if user, exist := usersLoginInfo[token]; exist {
67 c.JSON(http.StatusOK, UserLoginResponse{
68 Response: Response{StatusCode: 0},
69 UserId: user.Id,
70 Token: token,
71 })
72 } else {
73 c.JSON(http.StatusOK, UserLoginResponse{
74 Response: Response{StatusCode: 1, StatusMsg: "User doesn't exist"},
75 })
76 }
77}
78
79func UserInfo(c *gin.Context) {
80 token := c.Query("token")

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected