BookStack/resources/js/components/new-user-password.js

26 lines
818 B
JavaScript
Raw Normal View History

import {Component} from "./component";
2019-08-18 20:11:30 +08:00
export class NewUserPassword extends Component {
2019-08-18 20:11:30 +08:00
setup() {
this.container = this.$el;
this.inputContainer = this.$refs.inputContainer;
this.inviteOption = this.container.querySelector('input[name=send_invite]');
2019-08-18 20:11:30 +08: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 20:11:30 +08:00
for (const input of passwordBoxes) {
input.disabled = inviting;
}
this.inputContainer.style.display = inviting ? 'none' : 'block';
}
2019-08-18 20:11:30 +08:00
}