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