mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-23 00:16:25 +01:00
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
30 lines
756 B
TypeScript
30 lines
756 B
TypeScript
import { TestResult } from 'owasp-password-strength-test';
|
|
|
|
class OwaspValidationError extends Error {
|
|
private errors: string[];
|
|
|
|
constructor(testResult: TestResult) {
|
|
super(testResult.errors[0]);
|
|
Error.captureStackTrace(this, this.constructor);
|
|
this.name = this.constructor.name;
|
|
this.errors = testResult.errors;
|
|
}
|
|
|
|
toJSON(): any {
|
|
const obj = {
|
|
isJoi: true,
|
|
name: this.constructor.name,
|
|
details: [
|
|
{
|
|
validationErrors: this.errors,
|
|
message: this.errors[0],
|
|
},
|
|
],
|
|
};
|
|
return obj;
|
|
}
|
|
}
|
|
|
|
export default OwaspValidationError;
|
|
module.exports = OwaspValidationError;
|