mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-22 14:49:59 +08:00
Upgraded app to Laravel 5.7
This commit is contained in:
28
resources/js/components/new-user-password.js
Normal file
28
resources/js/components/new-user-password.js
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
class NewUserPassword {
|
||||
|
||||
constructor(elem) {
|
||||
this.elem = elem;
|
||||
this.inviteOption = elem.querySelector('input[name=send_invite]');
|
||||
|
||||
if (this.inviteOption) {
|
||||
this.inviteOption.addEventListener('change', this.inviteOptionChange.bind(this));
|
||||
this.inviteOptionChange();
|
||||
}
|
||||
}
|
||||
|
||||
inviteOptionChange() {
|
||||
const inviting = (this.inviteOption.value === 'true');
|
||||
const passwordBoxes = this.elem.querySelectorAll('input[type=password]');
|
||||
for (const input of passwordBoxes) {
|
||||
input.disabled = inviting;
|
||||
}
|
||||
const container = this.elem.querySelector('#password-input-container');
|
||||
if (container) {
|
||||
container.style.display = inviting ? 'none' : 'block';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default NewUserPassword;
|
Reference in New Issue
Block a user