Added the account recovery flow

This commit is contained in:
Vladyslav Matsiiako
2022-12-12 20:42:16 -05:00
parent c83c75db96
commit 07bb3496e7
12 changed files with 616 additions and 67 deletions

View File

@@ -2,25 +2,25 @@ import { Schema, model } from 'mongoose';
import { EMAIL_TOKEN_LIFETIME } from '../config';
export interface IToken {
email: String;
token: String;
createdAt: Date;
email: string;
token: string;
createdAt: Date;
}
const tokenSchema = new Schema<IToken>({
email: {
type: String,
required: true
},
token: {
type: String,
required: true
},
createdAt: {
type: Date,
expires: parseInt(EMAIL_TOKEN_LIFETIME),
default: Date.now
}
email: {
type: String,
required: true
},
token: {
type: String,
required: true
},
createdAt: {
type: Date,
expires: parseInt(EMAIL_TOKEN_LIFETIME),
default: Date.now
}
});
const Token = model<IToken>('Token', tokenSchema);