MCPcopy Index your code
hub / github.com/dearcode/candy / Login

Method Login

client/candy.go:100–116  ·  view source on GitHub ↗

Login 用户登陆

(user, passwd string)

Source from the content-addressed store, hash-verified

98
99// Login 用户登陆
100func (c *CandyClient) Login(user, passwd string) (int64, error) {
101 if code, err := CheckUserName(user); err != nil {
102 return -1, NewError(code, err.Error())
103 }
104
105 if code, err := CheckUserPassword(passwd); err != nil {
106 return -1, NewError(code, err.Error())
107 }
108
109 req := &meta.GateUserLoginRequest{User: user, Password: passwd}
110 resp, err := c.api.Login(context.Background(), req)
111 if err != nil {
112 return -1, err
113 }
114
115 return resp.ID, resp.Header.JsonError()
116}
117
118// Logout 注销登陆
119func (c *CandyClient) Logout() error {

Callers

nothing calls this directly

Calls 6

CheckUserNameFunction · 0.85
NewErrorFunction · 0.85
CheckUserPasswordFunction · 0.85
JsonErrorMethod · 0.80
LoginMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected