2023-04-18 23:20:02 +02:00
|
|
|
import {Component} from './component';
|
2019-08-18 14:11:30 +02:00
|
|
|
|
2022-11-15 17:04:46 +01:00
|
|
|
export class NewUserPassword extends Component {
|
2019-08-18 14:11:30 +02:00
|
|
|
|
2022-11-15 17:04:46 +01: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');
|
2022-11-15 17:04:46 +01:00
|
|
|
const passwordBoxes = this.container.querySelectorAll('input[type=password]');
|
2019-08-18 14:11:30 +02:00
|
|
|
for (const input of passwordBoxes) {
|
|
|
|
input.disabled = inviting;
|
|
|
|
}
|
|
|
|
|
2022-11-15 17:04:46 +01:00
|
|
|
this.inputContainer.style.display = inviting ? 'none' : 'block';
|
|
|
|
}
|
2019-08-18 14:11:30 +02:00
|
|
|
|
2023-04-18 23:20:02 +02:00
|
|
|
}
|