Reduce duplicate code, move shit out to common package

This commit is contained in:
2023-05-30 20:22:55 -04:00
parent 64e1f53f4e
commit 4ce4b62fe5
30 changed files with 106 additions and 192 deletions

View File

@@ -1,11 +1,12 @@
import { Types } from 'mongoose';
import { Log, Strategy, Token } from '..';
import { STRATEGIES } from '../constants/strategies';
import { Action } from '@mifi/auth-common/lib/enums/action';
import { STRATEGIES } from '@mifi/auth-common/lib/enums/strategies';
import { generateLoginToken } from '@mifi/auth-common/lib/utils/generateLoginToken';
import { AuthDocument } from '../schema/auth';
import { getLoginToken } from '../utils/getLoginToken';
import { StrategyDocument } from '../schema/strategy';
import { Action } from '../constants/action';
import { Log, Strategy, Token } from '..';
export const resetPasswordPost = async (token: string, password: string) => {
const parentId = await Token.validateResetToken(token);
@@ -34,7 +35,7 @@ export const resetPasswordPost = async (token: string, password: string) => {
}
Log.add(parent._id, Action.RESET);
return { record: parent.record, token: getLoginToken(parent) };
return { record: parent.record, token: generateLoginToken(parent) };
}
return false;