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:
Deluan Quintão
2021-06-18 18:38:38 -04:00
committed by GitHub
parent d42dfafad4
commit 66b74c81f1
12 changed files with 302 additions and 7 deletions
+4 -2
View File
@@ -28,9 +28,11 @@ type UserRepository interface {
CountAll(...QueryOptions) (int64, error)
Get(id string) (*User, error)
Put(*User) error
UpdateLastLoginAt(id string) error
UpdateLastAccessAt(id string) error
FindFirstAdmin() (*User, error)
// FindByUsername must be case-insensitive
FindByUsername(username string) (*User, error)
UpdateLastLoginAt(id string) error
UpdateLastAccessAt(id string) error
// FindByUsernameWithPassword is the same as above, but also returns the decrypted password
FindByUsernameWithPassword(username string) (*User, error)
}