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:
@@ -36,13 +36,18 @@ var _ = Describe("UserRepository", func() {
|
||||
actual, err := repo.Get("123")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(actual.Name).To(Equal("Admin"))
|
||||
Expect(actual.Password).To(Equal("wordpass"))
|
||||
})
|
||||
It("find the user by case-insensitive username", func() {
|
||||
actual, err := repo.FindByUsername("aDmIn")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(actual.Name).To(Equal("Admin"))
|
||||
})
|
||||
It("find the user by username and decrypts the password", func() {
|
||||
actual, err := repo.FindByUsernameWithPassword("aDmIn")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(actual.Name).To(Equal("Admin"))
|
||||
Expect(actual.Password).To(Equal("wordpass"))
|
||||
})
|
||||
})
|
||||
|
||||
Describe("validatePasswordChange", func() {
|
||||
|
||||
Reference in New Issue
Block a user