Added Access-Control-Allow-Origin to Login POST header for CORS conformity
This commit is contained in:
parent
3f383e6527
commit
4524d95a7c
5 changed files with 31 additions and 15 deletions
7
motorradig/.idea/workspace.xml
generated
7
motorradig/.idea/workspace.xml
generated
|
|
@ -5,11 +5,8 @@
|
|||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/public/js/app.js" beforeDir="false" afterPath="$PROJECT_DIR$/public/js/app.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/js/store.js" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/store.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/js/views/EditPage.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/views/EditPage.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/js/views/Gallery.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/views/Gallery.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/js/views/Main.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/views/Main.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/js/views/Upload.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/views/Upload.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/js/views/UserList.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/views/UserList.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/js/views/auth/Login.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/views/auth/Login.vue" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/resources/js/views/auth/Register.vue" beforeDir="false" afterPath="$PROJECT_DIR$/resources/js/views/auth/Register.vue" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
|
|||
19
motorradig/public/js/app.js
vendored
19
motorradig/public/js/app.js
vendored
|
|
@ -2714,9 +2714,17 @@ __webpack_require__.r(__webpack_exports__);
|
|||
password: this.password
|
||||
};
|
||||
console.log(formData);
|
||||
axios.post('http://localhost:8000/api/v1/auth/login', {
|
||||
var api_url = this.$store.state.app_url + '/api/v1/auth/login';
|
||||
console.log("Target URL:" + api_url);
|
||||
axios.post(api_url, {
|
||||
email: this.email,
|
||||
password: this.password
|
||||
}, {
|
||||
// Trying to manage CORS
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}).then(function (res) {
|
||||
console.log("Login successful. Token=" + res.headers.authorization);
|
||||
_this.$store.state.user_token = res.headers.authorization;
|
||||
|
|
@ -2730,7 +2738,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||
|
||||
_this.$router.push('/');
|
||||
})["catch"](function (error) {
|
||||
console.log("Login unsuccessful."); //console.log(error)
|
||||
console.log("Login unsuccessful.");
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
@ -2835,7 +2844,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||
password_confirmation: this.password_confirmation
|
||||
};
|
||||
console.log(formData);
|
||||
axios.post('http://localhost:8000/api/v1/auth/register', {
|
||||
axios.post(this.$store.state.app_url + '/api/v1/auth/register', {
|
||||
name: this.name,
|
||||
email: this.email,
|
||||
password: this.password,
|
||||
|
|
@ -49220,8 +49229,8 @@ var store = new vuex__WEBPACK_IMPORTED_MODULE_1__["default"].Store({
|
|||
userlist: {},
|
||||
folders: {},
|
||||
selectedFolder: "default",
|
||||
//app_url:"http://www.programmschmiede.de"
|
||||
app_url: "http://www.localhost:8000"
|
||||
app_url: "http://www.programmschmiede.de" //app_url:"http://www.localhost:8000"
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
4
motorradig/resources/js/store.js
vendored
4
motorradig/resources/js/store.js
vendored
|
|
@ -12,7 +12,7 @@ export const store = new Vuex.Store({
|
|||
folders:{},
|
||||
selectedFolder:"default",
|
||||
|
||||
//app_url:"http://www.programmschmiede.de"
|
||||
app_url:"http://www.localhost:8000"
|
||||
app_url:"http://www.programmschmiede.de"
|
||||
//app_url:"http://www.localhost:8000"
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -63,9 +63,19 @@
|
|||
password: this.password,
|
||||
}
|
||||
console.log(formData)
|
||||
axios.post('http://localhost:8000/api/v1/auth/login', {
|
||||
|
||||
let api_url=this.$store.state.app_url +'/api/v1/auth/login';
|
||||
console.log("Target URL:"+api_url);
|
||||
|
||||
axios.post(api_url, {
|
||||
email: this.email,
|
||||
password: this.password
|
||||
}, {
|
||||
// Trying to manage CORS
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log("Login successful. Token="+res.headers.authorization);
|
||||
|
|
@ -83,7 +93,7 @@
|
|||
)
|
||||
.catch(error => {
|
||||
console.log("Login unsuccessful.");
|
||||
//console.log(error)
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
password_confirmation: this.password_confirmation,
|
||||
};
|
||||
console.log(formData);
|
||||
axios.post('http://localhost:8000/api/v1/auth/register', {
|
||||
axios.post(this.$store.state.app_url +'/api/v1/auth/register', {
|
||||
name: this.name,
|
||||
email: this.email,
|
||||
password: this.password,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue