Skip to content

Commit 2c30b2f

Browse files
committed
feat: add a checkbox to toggle password visibility
This commit adds the ability to toggle the password visibility for the password input for guests in password-protected bbb rooms.
1 parent 5935c09 commit 2c30b2f

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

templates/join.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
required minlength="3" autofocus />
2424
<?php if (isset($_['passwordRequired']) && $_['passwordRequired']): ?>
2525
<label for="password" class="infield"><?php p($l->t('Password')); ?></label>
26-
<input type="text" name="password" id="password" class="bbb-input"
26+
<input type="password" name="password" id="password" class="bbb-input"
2727
placeholder="<?php p($l->t('Password')); ?>" value=""
2828
required minlength="8" />
29+
<input type="checkbox" name="password-visibility-toggle" id="password-visibility" class="checkbox" value=""/>
30+
<label for="password-visibility"><?php p($l->t('Show Password')); ?></label>
2931
<button class="primary"><?php p($l->t('Join')); ?>
3032
<div class="submit-icon icon-confirm-white"></div></button>
3133
<?php else: ?>

ts/join.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
import './join.scss';
1+
import './join.scss';
2+
3+
4+
$(() => {
5+
$<HTMLInputElement>('#password-visibility').on('change', function (ev) {
6+
ev.preventDefault();
7+
8+
console.log(`checkbox ${ev.target.name} changed to ${ev.target.checked}`);
9+
10+
const passwordField = document.querySelector("#password") as HTMLInputElement | null;
11+
12+
if (passwordField != null) {
13+
if (passwordField.type === "password") {
14+
passwordField.type = "text";
15+
} else {
16+
passwordField.type = "password";
17+
}
18+
}
19+
});
20+
});

0 commit comments

Comments
 (0)