mirror of
				https://github.com/BookStackApp/BookStack.git
				synced 2025-10-31 03:50:27 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			824 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			824 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 
 | |
| 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; |