Encrypt passwords in DB (#1187)
* Encode/Encrypt passwords in DB * Only decrypts passwords if it is necessary * Add tests for encryption functions
This commit is contained in:
+1
-1
@@ -152,7 +152,7 @@ func createAdminUser(ctx context.Context, ds model.DataStore, username, password
|
||||
}
|
||||
|
||||
func validateLogin(userRepo model.UserRepository, userName, password string) (*model.User, error) {
|
||||
u, err := userRepo.FindByUsername(userName)
|
||||
u, err := userRepo.FindByUsernameWithPassword(userName)
|
||||
if err == model.ErrNotFound {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ func authenticate(ds model.DataStore) func(next http.Handler) http.Handler {
|
||||
}
|
||||
|
||||
func validateUser(ctx context.Context, ds model.DataStore, username, pass, token, salt, jwt string) (*model.User, error) {
|
||||
user, err := ds.User(ctx).FindByUsername(username)
|
||||
user, err := ds.User(ctx).FindByUsernameWithPassword(username)
|
||||
if err == model.ErrNotFound {
|
||||
return nil, model.ErrInvalidAuth
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user