-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathResetPwdShortService.ts
44 lines (39 loc) · 1.34 KB
/
ResetPwdShortService.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { makeDefaultOptions } from '../options';
import { resetPwdWithShortToken } from '../methods/reset-password';
import { AuthenticationManagementBase } from './AuthenticationManagementBase';
import type {
DataResetPwdShort,
SanitizedUser,
ResetPwdWithShortServiceOptions
} from '../types';
import type { Application, Params } from '@feathersjs/feathers';
export class ResetPwdShortService
extends AuthenticationManagementBase<DataResetPwdShort, SanitizedUser, ResetPwdWithShortServiceOptions> {
constructor (app: Application, options?: Partial<ResetPwdWithShortServiceOptions>) {
super(app);
const defaultOptions: ResetPwdWithShortServiceOptions = makeDefaultOptions([
'service',
'skipIsVerifiedCheck',
'reuseResetToken',
'notifier',
'reuseResetToken',
'sanitizeUserForClient',
'passwordField',
'skipPasswordHash',
'identifyUserProps',
'passParams'
]);
this.options = Object.assign(defaultOptions, options);
}
async _create (data: DataResetPwdShort, params?: Params): Promise<SanitizedUser> {
const passedParams = this.options.passParams && await this.options.passParams(params);
return await resetPwdWithShortToken(
this.optionsWithApp,
data.token,
data.user,
data.password,
data.notifierOptions,
passedParams
);
}
}