]> BookStack Code Mirror - bookstack/blob - resources/js/components/new-user-password.js
Merge branch 'patching-v0.27'
[bookstack] / resources / js / components / new-user-password.js
1
2 class NewUserPassword {
3
4     constructor(elem) {
5         this.elem = elem;
6         this.inviteOption = elem.querySelector('input[name=send_invite]');
7
8         if (this.inviteOption) {
9             this.inviteOption.addEventListener('change', this.inviteOptionChange.bind(this));
10             this.inviteOptionChange();
11         }
12     }
13
14     inviteOptionChange() {
15         const inviting = (this.inviteOption.value === 'true');
16         const passwordBoxes = this.elem.querySelectorAll('input[type=password]');
17         for (const input of passwordBoxes) {
18             input.disabled = inviting;
19         }
20         const container = this.elem.querySelector('#password-input-container');
21         if (container) {
22             container.style.display = inviting ? 'none' : 'block';
23         }
24     }
25
26 }
27
28 export default NewUserPassword;