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