MCPcopy Create free account
hub / github.com/LockGit/gochat / Register

Function Register

api/handler/user.go:44–60  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

42}
43
44func 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
62type FormCheckAuth struct {
63 AuthToken string `form:"authToken" json:"authToken" binding:"required"`

Callers

nothing calls this directly

Calls 4

FailWithMsgFunction · 0.92
Sha1Function · 0.92
SuccessWithMsgFunction · 0.92
RegisterMethod · 0.45

Tested by

no test coverage detected