Password required to send email

This commit is contained in:
neviyn 2019-12-20 10:58:59 +00:00
parent 1c06fe00b9
commit 8fb6142cb7

View File

@ -49,6 +49,20 @@
<button class="btn" @click="$refs.emailCompleteModal.hide()">OK</button>
</div>
</b-modal>
<b-modal
id="submissionModal"
ref="submissionModal"
title="Enter password to confirm send email"
@ok="sendEmail"
>
<form @submit.stop.prevent="handleSubmit">
<b-form-input
type="password"
placeholder="Enter password"
v-model="submitPassword"
></b-form-input>
</form>
</b-modal>
<b-row class="pb-2">
<b-col>
<b-button-group size="sm">
@ -290,7 +304,7 @@
<b-button class="mt-2" variant="success" @click="getCSV()"
>CSV Dump</b-button
>&nbsp;
<b-button class="mt-2" variant="success" @click="sendEmail()"
<b-button class="mt-2" variant="success" @click="getPasswordToSendEmail()"
>Send as Email</b-button
>
</b-container>
@ -323,7 +337,8 @@ export default {
observationData: null,
errorStatus: null,
errorMessage: null,
loading: false
loading: false,
submitPassword: null
};
},
computed: {
@ -403,7 +418,18 @@ export default {
this.endDate = moment();
this.startDate = moment().subtract(amount, timeType);
},
getPasswordToSendEmail: function() {
this.submitPassword = null;
this.$refs.submissionModal.show();
},
sendEmail: function() {
this.$refs.submissionModal.hide();
let axiosConfig = {
auth: {
username: "admin",
password: this.submitPassword
}
};
this.$refs.emailSendingModal.show();
Vue.axios
.post("/observations/email", {
@ -413,7 +439,7 @@ export default {
endDate: moment(this.endDate).format("YYYY-MM-DD"),
whom: this.$store.state.search.whom,
person: this.$store.state.search.person
})
}, axiosConfig)
.then(() => {
this.$refs.emailSendingModal.hide();
this.$refs.emailCompleteModal.show();
@ -424,6 +450,7 @@ export default {
this.errorMessage = error.response.data;
this.$refs.errorModal.show();
});
this.submitPassword = null;
}
}
};