mirror of
https://github.com/standardnotes/server
synced 2026-10-16 18:13:09 -04:00
feat: sqlite driver for auth service (#572)
* wip: initial sqlite bootstrap * wip: switch to sqlite3 as default db type * wip: boilerplate data * fix(auth): case sensitive register and login * fix(auth): refactor username validations * fix(auth): allow changing username to both username and email: * fix(auth): lock middleware for recovery log in * fix(domain-core): specs for invalid types * fix(auth): lock middleware specs * fix(auth): typeorm code arrangements * fix: running e2e on both mysql and sqlite in ci
This commit is contained in:
+3
-3
@@ -40,7 +40,7 @@ describe('GenerateAuthenticatorAuthenticationOptions', () => {
|
||||
authenticatorChallengeRepository.save = jest.fn()
|
||||
|
||||
userRepository = {} as jest.Mocked<UserRepositoryInterface>
|
||||
userRepository.findOneByEmail = jest.fn().mockReturnValue({
|
||||
userRepository.findOneByUsernameOrEmail = jest.fn().mockReturnValue({
|
||||
uuid: '00000000-0000-0000-0000-000000000000',
|
||||
} as jest.Mocked<User>)
|
||||
})
|
||||
@@ -57,7 +57,7 @@ describe('GenerateAuthenticatorAuthenticationOptions', () => {
|
||||
})
|
||||
|
||||
it('should return error if user uuid is not valid', async () => {
|
||||
userRepository.findOneByEmail = jest.fn().mockReturnValue({
|
||||
userRepository.findOneByUsernameOrEmail = jest.fn().mockReturnValue({
|
||||
uuid: 'invalid',
|
||||
} as jest.Mocked<User>)
|
||||
|
||||
@@ -74,7 +74,7 @@ describe('GenerateAuthenticatorAuthenticationOptions', () => {
|
||||
})
|
||||
|
||||
it('should return pseudo options if user is not found', async () => {
|
||||
userRepository.findOneByEmail = jest.fn().mockReturnValue(null)
|
||||
userRepository.findOneByUsernameOrEmail = jest.fn().mockReturnValue(null)
|
||||
|
||||
const useCase = createUseCase()
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ export class GenerateAuthenticatorAuthenticationOptions implements UseCaseInterf
|
||||
}
|
||||
const username = usernameOrError.getValue()
|
||||
|
||||
const user = await this.userRepository.findOneByEmail(username.value)
|
||||
const user = await this.userRepository.findOneByUsernameOrEmail(username)
|
||||
if (user === null) {
|
||||
const credentialIdHash = crypto
|
||||
.createHash('sha256')
|
||||
|
||||
Reference in New Issue
Block a user