Skip to content

Commit 15c38c0

Browse files
authored
additionalData on reset password field (captcha) (#521)
* additionalData on reset password field (captcha) * Fix Documentation with additionalData
1 parent 256d9c9 commit 15c38c0

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

docs/session-management.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ Once initialized `AngularTokenService` offers methods for session management:
1212

1313
## .signIn()
1414
The signIn method is used to sign in the user with login (e.g. email address) and password.
15-
The optional parameter `type` specifies the name of UserType used for this session.
15+
The optional parameter `userType` specifies the name of UserType used for this session.
1616

17-
`signIn({login: string, password: string, userType?: string}): Observable<Response>`
17+
The optional parameter `additionalData` allows to pass custom data for the login logic (Example use case: Recaptcha).
18+
19+
`signIn({login: string, password: string, userType?: string}, additionalData?: any): Observable<Response>`
1820

1921
#### Example:
2022
```javascript
2123
this.tokenService.signIn({
22-
23-
password: 'secretPassword'
24-
}).subscribe(
24+
25+
password: 'secretPassword',
26+
}, additionalData).subscribe(
2527
res => console.log(res),
2628
error => console.log(error)
2729
);
@@ -43,15 +45,17 @@ this.tokenService.signOut().subscribe(
4345
## .registerAccount()
4446
Sends a new user registration request to the Server.
4547

46-
`registerAccount({login: string, password: string, passwordConfirmation: string, userType?: string}): Observable<Response>`
48+
The optional parameter `additionalData` allows to pass custom data for the registration logic (Example use case: Recaptcha).
49+
50+
`registerAccount({login: string, password: string, passwordConfirmation: string, userType?: string}, additionalData?: any): Observable<Response>`
4751

4852
#### Example:
4953
```javascript
5054
this.tokenService.registerAccount({
5155
5256
password: 'secretPassword',
5357
passwordConfirmation: 'secretPassword'
54-
}).subscribe(
58+
}, additionalData).subscribe(
5559
res => console.log(res),
5660
error => console.log(error)
5761
);
@@ -137,13 +141,13 @@ end
137141
```
138142
********
139143

140-
`resetPassword({login: string, userType?: string}): Observable<Response>`
144+
`resetPassword({login: string, userType?: string}, additionalData?: any): Observable<Response>`
141145

142146
#### Example:
143147
```javascript
144148
this.tokenService.resetPassword({
145149
146-
}).subscribe(
150+
}, additionalData).subscribe(
147151
res => console.log(res),
148152
error => console.log(error)
149153
);

projects/angular-token/src/lib/angular-token.service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,12 @@ export class AngularTokenService implements CanActivate {
398398
}
399399

400400
// Reset password request
401-
resetPassword(resetPasswordData: ResetPasswordData): Observable<ApiResponse> {
401+
resetPassword(resetPasswordData: ResetPasswordData, additionalData?: any): Observable<ApiResponse> {
402+
403+
404+
if (additionalData !== undefined) {
405+
resetPasswordData.additionalData = additionalData;
406+
}
402407

403408
this.userType.next(
404409
(resetPasswordData.userType == null) ? null : this.getUserTypeByName(resetPasswordData.userType)

0 commit comments

Comments
 (0)