17 lines
684 B
TypeScript
17 lines
684 B
TypeScript
import { CredentialsSignin } from "next-auth";
|
|
|
|
/**
|
|
* Thrown from `authorize()` (in auth.ts) when a PENDING user's credentials
|
|
* are otherwise correct. Kept distinct from a plain `return null` (bad
|
|
* email/password) so `login()` (in lib/actions/auth.ts) can show a message
|
|
* that actually explains why the login failed, instead of "incorrect email
|
|
* or password."
|
|
*
|
|
* Auth.js rethrows errors from `authorize()` as-is when `signIn()` is
|
|
* called from a Server Action (see @auth/core's raw-mode handling), so
|
|
* `login()` can catch this by its `code` rather than parsing `message`.
|
|
*/
|
|
export class PendingAccountSignin extends CredentialsSignin {
|
|
code = "pending-account";
|
|
}
|