MCPcopy Index your code
hub / github.com/prest/prest / basicPasswordCheckBcrypt

Method basicPasswordCheckBcrypt

controllers/auth.go:149–168  ·  view source on GitHub ↗
(user, password string)

Source from the content-addressed store, hash-verified

147}
148
149func (h *AuthHandler) basicPasswordCheckBcrypt(user, password string) (obj auth.User, err error) {
150 sc := h.executor.Query(h.selectQueryByUsername(), user)
151 if sc.Err() != nil {
152 err = sc.Err()
153 return
154 }
155 var row loginRow
156 n, err := sc.Scan(&row)
157 if err != nil {
158 return
159 }
160 if n != 1 {
161 err = ErrUserNotFound
162 return
163 }
164 if err = h.verifyStoredPassword(password, row.Password); err != nil {
165 return
166 }
167 return row.user(), nil
168}
169
170// verifyStoredPassword verifies the stored password against the password provided.
171// It returns an error if the password is not valid.

Callers 1

basicPasswordCheckMethod · 0.95

Calls 6

selectQueryByUsernameMethod · 0.95
verifyStoredPasswordMethod · 0.95
userMethod · 0.95
QueryMethod · 0.65
ErrMethod · 0.65
ScanMethod · 0.65

Tested by

no test coverage detected