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