Finishing touches to publish
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-05-03 11:38:41 -04:00
parent dc72cefece
commit 32bfbd7adc
15 changed files with 36 additions and 38 deletions

5
lib/db/index.ts Normal file
View File

@@ -0,0 +1,5 @@
import mongoose from 'mongoose';
import { DB_HOST, DB_NAME, DB_PASS, DB_PORT, DB_USER } from '../constants/db';
export const connection = mongoose.connect(`mongodb://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}`);

View File

@@ -6,7 +6,7 @@ import { STRATEGIES } from '../../constants/strategies';
import { TokenProps, verify as verifyJwt } from '../../utils/jwt';
import { encrypt, verify as verifyPassword } from '../../utils/password';
import { generateLoginToken, generateResetToken } from '../../utils/tokens';
import { getPasswordResetLink } from '../../utils/links';
import { getPasswordResetPath } from '../../utils/links';
import { Status } from '../../constants/auth';
export type Auth = {
@@ -42,7 +42,7 @@ export const AuthSchema = new Schema<AuthPrivate, AuthModel, AuthMethods>(
{
is2FA: { type: Boolean, default: false },
record: { type: Types.ObjectId },
strategies: { type: Types.ArraySubdocument<Strategy>, required: true },
strategies: { type: Array<Strategy>, required: true },
status: { type: Number, enum: Object.values(Status), default: Status.UNVERIFIED },
username: { type: String, required: true, unique: true },
},
@@ -69,7 +69,7 @@ AuthSchema.methods = {
async getResetLink(route) {
const token = await this.getResetToken();
if (token) {
const resetUrl = getPasswordResetLink(token);
const resetUrl = getPasswordResetPath(token);
console.log('[sendPasswordReset] resetUrl:', resetUrl);
return resetUrl;
}