Breaking down mega-package. Hello auth-db 1.0.0!
This commit is contained in:
18
lib/api/resetPasswordGet.ts
Normal file
18
lib/api/resetPasswordGet.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { readOneByUsername } from '../dao/readOneByUsername';
|
||||
import { Log, Token } from '..';
|
||||
import { TokenType } from '../../constants/tokens';
|
||||
import { Action } from '../../constants/action';
|
||||
|
||||
export const resetPasswordGet = async (username: string) => {
|
||||
const doc = await readOneByUsername(username);
|
||||
|
||||
if (doc) {
|
||||
Log.add(doc._id, Action.RESET_REQUEST);
|
||||
return {
|
||||
record: doc.record,
|
||||
token: Token.getToken(TokenType.RESET, doc._id),
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
Reference in New Issue
Block a user