fix: Improve handling of suspended users signing in with email (#2012)
* chore: Separate signin/auth middleware fix: Email signin token parsed by JWT middleware fix: Email signin marked as active when logging in as suspended fix: Suspended email signin correctly redirected to login screen closes #1740 * refactor middleware -> lib * lint
This commit is contained in:
@ -21,6 +21,10 @@ function getJWTPayload(token) {
|
||||
export async function getUserForJWT(token: string): Promise<User> {
|
||||
const payload = getJWTPayload(token);
|
||||
|
||||
if (payload.type === "email-signin") {
|
||||
throw new AuthenticationError("Invalid token");
|
||||
}
|
||||
|
||||
// check the token is within it's expiration time
|
||||
if (payload.expiresAt) {
|
||||
if (new Date(payload.expiresAt) < new Date()) {
|
||||
|
Reference in New Issue
Block a user