Skip to content
Snippets Groups Projects
Commit 26e2f4b9 authored by !! Julian Keck (old Account; do not use) !!'s avatar !! Julian Keck (old Account; do not use) !! :ghost:
Browse files

FIX: better error-handling for ip-contact

Closes #776
parent 4c55046c
No related branches found
No related tags found
No related merge requests found
......@@ -504,6 +504,7 @@
"impersonating": "Betrachtet als",
"incompatible_token": "Ihr Sitzungs-Token ist inkompatibel mit der aktuellen Version des NETVS. Bitte melden Sie sich ab und wieder an und löschen Sie ggf. alte Sitzungs-Tokens manuell aus Ihrem Account.",
"incompatible_token_title": "Inkompatibles Sitzungs-Token",
"internal_error": "Internet (Netzwerk-)Fehler",
"invalid_impersonate_user_event": "Der angegebene Account als den Sie sich ausgeben wollten existiert nicht. Sie agieren nun wieder im Kontext Ihres eigenen Accounts.",
"invalid_impersonate_user_event_title": "Ungültiger Benutzername",
"invalid_ipv6": "Ungültige IPv6-Adresse!",
......@@ -966,6 +967,7 @@
"ip_contact": {
"description": "Dieses Formular erlaubt es Ihnen, die Adressbetreuer von einer angegebenen Adresse zu kontaktieren.",
"failed": "Senden der Anfrage fehlgeschlagen! Fehlerursache: ",
"invalid_ip": "Ungültige IP-Adresse",
"message": "Nachricht",
"submit": "Absenden",
"success": "E-Mail erfolgreich an die Adressbetreuer versendet!"
......
......@@ -501,6 +501,7 @@
"impersonating": "Impersonating",
"incompatible_token": "You session token is incompatible with the current version of NETVS. Please log out and log in again and delete old session tokens from your account.",
"incompatible_token_title": "Incompatible session token",
"internal_error": "Internal (network-)error",
"invalid_impersonate_user_event": "The account you tried to impersonate does not exist. Falling back to your own account.",
"invalid_impersonate_user_event_title": "Invalid username",
"invalid_ipv6": "Invalid IPv6 Address!",
......@@ -974,6 +975,7 @@
"ip_contact": {
"description": "This form allows you to contact the network administrators of a given IP-address.",
"failed": "Message could not be sent! Reason: ",
"invalid_ip": "Invalid ip-address",
"message": "Message",
"submit": "Send",
"success": "E-Mail to BCD-administrators was sent successfully!"
......
......@@ -17,10 +17,14 @@
variant="danger">
{{ $t('views.tools.ip_contact.failed') }}{{ failure_reason }}
</b-alert>
<b-alert
:show="check_cidr === false && show_ip_error"
variant="danger">
{{ $t('views.tools.ip_contact.invalid_ip') }}
</b-alert>
<b-form @submit="submitMessage">
<b-form-group :label="$t('system.ip_address_or_cidr') + ':'">
<b-input required v-model="cidr" :placeholder="$t('system.ip_address_or_cidr')" :state="check_cidr"></b-input>
<b-input required v-model="cidr" :placeholder="$t('system.ip_address_or_cidr')" :state="check_cidr" @change="() => {if (cidr.length === 0) {show_ip_error = false}}"></b-input>
</b-form-group>
<b-textarea v-model="message" :placeholder="$t('views.tools.ip_contact.message')">
......@@ -47,12 +51,20 @@ export default {
message: '',
message_pending: false,
message_success: undefined,
failure_reason: ''
failure_reason: '',
show_ip_error: false,
}
},
methods: {
async submitMessage(ev) {
ev.preventDefault()
if (!this.check_cidr) {
this.show_ip_error = true
return false
}
this.show_ip_error = false
this.message_success = undefined
this.failure_reason = ''
......@@ -63,7 +75,9 @@ export default {
this.message = ''
setTimeout(() => { this.message_success = undefined }, 10_000)
}).catch(e => {
if (e.response.status === 404) {
if (!e.response) {
this.failure_reason = this.$t('system.internal_error')
} else if (e.response.status === 404) {
this.failure_reason = e.response.data.detail[this.$store.state.locale] || e.response.detail.en
this.message_success = false
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment