1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-30 15:42:41 +01:00
BookStack/resources/js/components/new-user-password.js

27 lines
819 B
JavaScript
Raw Normal View History

import {Component} from './component';
2019-08-18 14:11:30 +02:00
export class NewUserPassword extends Component {
2019-08-18 14:11:30 +02:00
setup() {
this.container = this.$el;
this.inputContainer = this.$refs.inputContainer;
this.inviteOption = this.container.querySelector('input[name=send_invite]');
2019-08-18 14:11:30 +02:00
if (this.inviteOption) {
this.inviteOption.addEventListener('change', this.inviteOptionChange.bind(this));
this.inviteOptionChange();
}
}
inviteOptionChange() {
const inviting = (this.inviteOption.value === 'true');
const passwordBoxes = this.container.querySelectorAll('input[type=password]');
2019-08-18 14:11:30 +02:00
for (const input of passwordBoxes) {
input.disabled = inviting;
}
this.inputContainer.style.display = inviting ? 'none' : 'block';
}
2019-08-18 14:11:30 +02:00
}