Skip to content

Commit

Permalink
fix open redirect issue in Login page
Browse files Browse the repository at this point in the history
  • Loading branch information
commiter committed Mar 14, 2024
1 parent 438902d commit 240fde3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rasp-vue/src/components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,16 @@ export default {
// ignored
})
},
validateRedirect(urlstring) {
let url = new URL(urlstring)
return url.protocol == location.protocol && url.host == location.host && url.port == location.port
},
doLogin: function() {
return request.post('v1/user/login', {
username: this.username,
password: this.password
}).then(res => {
if (this.$route.query.redirect) {
if (this.$route.query.redirect && this.validateRedirect(this.$route.query.redirect)) {
location.href = this.$route.query.redirect
} else {
this.$router.replace({
Expand Down

0 comments on commit 240fde3

Please sign in to comment.