1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-03 12:48:38 -04:00

Move users and securities to store

This commit is contained in:
2017-12-07 20:08:43 -05:00
parent c452984f23
commit bec5152e53
12 changed files with 255 additions and 185 deletions

View File

@ -85,12 +85,15 @@ func SessionHandler(r *http.Request, context *Context) ResponseWriterWriter {
return NewError(3 /*Invalid Request*/)
}
dbuser, err := GetUserByUsername(context.Tx, user.Username)
// Hash password before checking username to help mitigate timing
// attacks
user.HashPassword()
dbuser, err := context.StoreTx.GetUserByUsername(user.Username)
if err != nil {
return NewError(2 /*Unauthorized Access*/)
}
user.HashPassword()
if user.PasswordHash != dbuser.PasswordHash {
return NewError(2 /*Unauthorized Access*/)
}