Fix edition of source with redirections outside happyDNS

This commit is contained in:
nemunaire 2020-07-20 19:44:39 +02:00
parent 74a3b62861
commit e5476f884b
3 changed files with 9 additions and 5 deletions

View File

@ -87,6 +87,7 @@ func getSourceSettingsState(cfg *config.Options, req *RequestResources, body io.
if uss.Recall != nil {
req.Session.GetValue(fmt.Sprintf("source-creation-%d", *uss.Recall), src)
req.Session.GetValue(fmt.Sprintf("source-creation-%d-name", *uss.Recall), &uss.Name)
req.Session.GetValue(fmt.Sprintf("source-creation-%d-id", *uss.Recall), &uss.Id)
req.Session.GetValue(fmt.Sprintf("source-creation-%d-next", *uss.Recall), &uss.Redirect)
}
@ -104,6 +105,7 @@ func getSourceSettingsState(cfg *config.Options, req *RequestResources, body io.
key, recallid := req.Session.FindNewKey("source-creation-")
req.Session.SetValue(key, src)
req.Session.SetValue(key+"-name", uss.Name)
req.Session.SetValue(key+"-id", uss.Id)
if uss.Redirect != nil {
req.Session.SetValue(key+"-next", *uss.Redirect)
}

View File

@ -87,7 +87,7 @@ export default {
},
state: {
type: Number,
default: 1
default: 0
},
value: {
type: Object,

View File

@ -58,10 +58,11 @@ export default {
response => {
if (response.data.form) {
this.form = response.data.form
if (cbSuccess) {
this.state = toState
if (response.data.redirect && window.location.pathname !== response.data.redirect) {
this.$router.push(response.data.redirect)
} else if (cbSuccess) {
cbSuccess(toState)
} else {
this.state = toState
}
} else if (response.data.Source) {
this.$root.$bvToast.toast(
@ -72,12 +73,13 @@ export default {
toaster: 'b-toaster-content-right'
}
)
this.state = toState
if (response.data.redirect && window.location.pathname !== response.data.redirect) {
this.$router.push(response.data.redirect)
} else if (cbSuccess) {
cbSuccess(toState, response.data.Source)
} else {
this.state = toState
this.$router.push('/sources/' + encodeURIComponent(response.data.Source._id) + '/domains')
}
}
},