Skip to content

Commit

Permalink
Do not ignore password fields, but allow them to be masked instead
Browse files Browse the repository at this point in the history
  • Loading branch information
joris committed Oct 2, 2020
1 parent 425a040 commit 0cf62c0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ You may find some contents on the webpage which are not willing to be recorded,

- An element with the class name `.rr-block` will not be recorded. Instead, it will replay as a placeholder with the same dimension.
- An element with the class name `.rr-ignore` will not record its input events.
- `input[type="password"]` will be ignored as default.
- You’ll probably want to mask `input[type="password"]` by adding `maskInputOptions: {password: true}`

#### Checkout

Expand Down
6 changes: 4 additions & 2 deletions scripts/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ function getCode(): string {
rrweb.record({
emit: event => window._replLog(event),
recordCanvas: true,
collectFonts: true
collectFonts: true,
maskInputOptions: { password: true }
});
`);
page.on('framenavigated', async () => {
Expand All @@ -107,7 +108,8 @@ function getCode(): string {
rrweb.record({
emit: event => window._replLog(event),
recordCanvas: true,
collectFonts: true
collectFonts: true,
maskInputOptions: { password: true }
});
`);
}
Expand Down
1 change: 1 addition & 0 deletions src/record/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function record<T = eventWithTime>(
email: true,
month: true,
number: true,
password: true,
range: true,
search: true,
tel: true,
Expand Down
1 change: 0 additions & 1 deletion src/record/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ function initInputObserver(

const type: string | undefined = (target as HTMLInputElement).type;
if (
type === 'password' ||
(target as HTMLElement).classList.contains(ignoreClass)
) {
return;
Expand Down

0 comments on commit 0cf62c0

Please sign in to comment.