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

Method auth

store/user.go:134–151  ·  view source on GitHub ↗
(user, passwd string)

Source from the content-addressed store, hash-verified

132}
133
134func (u *userDB) auth(user, passwd string) (int64, error) {
135 v, err := u.db.Get([]byte(user), nil)
136 if err != nil {
137 return 0, errors.Trace(err)
138 }
139
140 var a account
141
142 if err = json.Unmarshal(v, &a); err != nil {
143 return 0, errors.Trace(err)
144 }
145
146 if a.Password != passwd {
147 return 0, errors.Errorf("invalid passwd:%s", string(passwd))
148 }
149
150 return a.ID, nil
151}
152
153func (u *userDB) updateUserPassword(user, passwd string) (int64, error) {
154 txn, err := u.db.OpenTransaction()

Callers 2

AuthMethod · 0.45
TestUserDBFunction · 0.45

Calls

no outgoing calls

Tested by 1

TestUserDBFunction · 0.36