1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/src/lib/error/used-token-error.ts
Christopher Kolstad b55c85783b
Reset token (#786)
feat: Add Reset token functionality

This allows admin users to create a reset token for other users. Thus allowing resetting their password.

Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>

fixes: #778
2021-04-16 15:29:23 +02:00

25 lines
585 B
TypeScript

class UsedTokenError extends Error {
constructor(usedAt: Date) {
super();
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = `Token was already used at ${usedAt}`;
}
toJSON(): any {
const obj = {
isJoi: true,
name: this.constructor.name,
details: [
{
message: this.message,
},
],
};
return obj;
}
}
export default UsedTokenError;
module.exports = UsedTokenError;