-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #318 from conceptadev/release/5.1.0
Release/5.1.0
- Loading branch information
Showing
17 changed files
with
246 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/nestjs-auth-local/src/exceptions/auth-local-invalid-credentials.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { RuntimeExceptionOptions } from '@concepta/nestjs-exception'; | ||
import { AuthLocalUnauthorizedException } from './auth-local-unauthorized.exception'; | ||
|
||
export class AuthLocalInvalidCredentialsException extends AuthLocalUnauthorizedException { | ||
constructor(options?: Omit<RuntimeExceptionOptions, 'httpStatus'>) { | ||
super({ | ||
safeMessage: | ||
'The provided username or password is incorrect. Please try again.', | ||
...options, | ||
}); | ||
|
||
this.errorCode = 'AUTH_LOCAL_INVALID_CREDENTIALS_ERROR'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/nestjs-auth-local/src/exceptions/auth-local-invalid-password.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { RuntimeExceptionOptions } from '@concepta/nestjs-exception'; | ||
import { AuthLocalInvalidCredentialsException } from './auth-local-invalid-credentials.exception'; | ||
|
||
export class AuthLocalInvalidPasswordException extends AuthLocalInvalidCredentialsException { | ||
constructor(userName: string, options?: RuntimeExceptionOptions) { | ||
super({ | ||
message: `Invalid password for username: %s`, | ||
messageParams: [userName], | ||
...options, | ||
}); | ||
|
||
this.errorCode = 'AUTH_LOCAL_INVALID_PASSWORD_ERROR'; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
packages/nestjs-auth-local/src/exceptions/auth-local-missing-login-dto.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { RuntimeExceptionOptions } from '@concepta/nestjs-exception'; | ||
import { HttpStatus } from '@nestjs/common'; | ||
import { AuthLocalException } from './auth-local.exception'; | ||
|
||
export class AuthLocalMissingLoginDtoException extends AuthLocalException { | ||
constructor(options?: RuntimeExceptionOptions) { | ||
super({ | ||
message: 'Login DTO is required, did someone remove the default?', | ||
httpStatus: HttpStatus.BAD_REQUEST, | ||
...options, | ||
}); | ||
|
||
this.errorCode = 'AUTH_LOCAL_MISSING_LOGIN_DTO_ERROR'; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/nestjs-auth-local/src/exceptions/auth-local-missing-password-field.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { RuntimeExceptionOptions } from '@concepta/nestjs-exception'; | ||
import { HttpStatus } from '@nestjs/common'; | ||
import { AuthLocalException } from './auth-local.exception'; | ||
|
||
export class AuthLocalMissingPasswordFieldException extends AuthLocalException { | ||
constructor(options?: RuntimeExceptionOptions) { | ||
super({ | ||
message: | ||
'Login password field is required, did someone remove the default?', | ||
httpStatus: HttpStatus.BAD_REQUEST, | ||
...options, | ||
}); | ||
|
||
this.errorCode = 'AUTH_LOCAL_MISSING_PASSWORD_FIELD_ERROR'; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/nestjs-auth-local/src/exceptions/auth-local-missing-username-field.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { RuntimeExceptionOptions } from '@concepta/nestjs-exception'; | ||
import { HttpStatus } from '@nestjs/common'; | ||
import { AuthLocalException } from './auth-local.exception'; | ||
|
||
export class AuthLocalMissingUsernameFieldException extends AuthLocalException { | ||
constructor(options?: RuntimeExceptionOptions) { | ||
super({ | ||
message: | ||
'Login username field is required, did someone remove the default?', | ||
httpStatus: HttpStatus.BAD_REQUEST, | ||
...options, | ||
}); | ||
|
||
this.errorCode = 'AUTH_LOCAL_MISSING_USERNAME_FIELD_ERROR'; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/nestjs-auth-local/src/exceptions/auth-local-unauthorized.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { RuntimeExceptionOptions } from '@concepta/nestjs-exception'; | ||
import { HttpStatus } from '@nestjs/common'; | ||
import { AuthLocalException } from './auth-local.exception'; | ||
|
||
export class AuthLocalUnauthorizedException extends AuthLocalException { | ||
constructor(options?: Omit<RuntimeExceptionOptions, 'httpStatus'>) { | ||
super({ | ||
message: 'Unauthorized', | ||
safeMessage: 'Unauthorized', | ||
...options, | ||
httpStatus: HttpStatus.UNAUTHORIZED, | ||
}); | ||
|
||
this.errorCode = 'AUTH_LOCAL_UNAUTHORIZED_ERROR'; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/nestjs-auth-local/src/exceptions/auth-local-user-inactive.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { RuntimeExceptionOptions } from '@concepta/nestjs-exception'; | ||
import { AuthLocalInvalidCredentialsException } from './auth-local-invalid-credentials.exception'; | ||
|
||
export class AuthLocalUserInactiveException extends AuthLocalInvalidCredentialsException { | ||
constructor(userName: string, options?: RuntimeExceptionOptions) { | ||
super({ | ||
message: `User with username '%s' is inactive`, | ||
messageParams: [userName], | ||
...options, | ||
}); | ||
|
||
this.errorCode = 'AUTH_LOCAL_USER_INACTIVE_ERROR'; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/nestjs-auth-local/src/exceptions/auth-local-username-not-found.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { RuntimeExceptionOptions } from '@concepta/nestjs-exception'; | ||
import { AuthLocalInvalidCredentialsException } from './auth-local-invalid-credentials.exception'; | ||
|
||
export class AuthLocalUsernameNotFoundException extends AuthLocalInvalidCredentialsException { | ||
constructor(userName: string, options?: RuntimeExceptionOptions) { | ||
super({ | ||
message: `No user found for username: %s`, | ||
messageParams: [userName], | ||
...options, | ||
}); | ||
|
||
this.errorCode = 'AUTH_LOCAL_USERNAME_NOT_FOUND_ERROR'; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/nestjs-auth-local/src/exceptions/auth-local.exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { | ||
RuntimeException, | ||
RuntimeExceptionOptions, | ||
} from '@concepta/nestjs-exception'; | ||
|
||
/** | ||
* Generic auth local exception. | ||
*/ | ||
export class AuthLocalException extends RuntimeException { | ||
constructor(options?: RuntimeExceptionOptions) { | ||
super(options); | ||
this.errorCode = 'AUTH_LOCAL_ERROR'; | ||
} | ||
} |
17 changes: 0 additions & 17 deletions
17
packages/nestjs-auth-local/src/exceptions/invalid-credentials.exception.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.