(c *gin.Context)
| 42 | } |
| 43 | |
| 44 | func Register(c *gin.Context) { |
| 45 | var formRegister FormRegister |
| 46 | if err := c.ShouldBindBodyWith(&formRegister, binding.JSON); err != nil { |
| 47 | tools.FailWithMsg(c, err.Error()) |
| 48 | return |
| 49 | } |
| 50 | req := &proto.RegisterRequest{ |
| 51 | Name: formRegister.UserName, |
| 52 | Password: tools.Sha1(formRegister.Password), |
| 53 | } |
| 54 | code, authToken, msg := rpc.RpcLogicObj.Register(req) |
| 55 | if code == tools.CodeFail || authToken == "" { |
| 56 | tools.FailWithMsg(c, msg) |
| 57 | return |
| 58 | } |
| 59 | tools.SuccessWithMsg(c, "register success", authToken) |
| 60 | } |
| 61 | |
| 62 | type FormCheckAuth struct { |
| 63 | AuthToken string `form:"authToken" json:"authToken" binding:"required"` |
nothing calls this directly
no test coverage detected