Commit d7a7bd84 authored by G2700's avatar G2700

login fixes

parent d4670394
......@@ -3055,6 +3055,13 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
name: "login",
......@@ -3063,7 +3070,8 @@ __webpack_require__.r(__webpack_exports__);
form: {
email: '',
password: ''
}
},
error: null
};
},
methods: {
......@@ -3083,6 +3091,11 @@ __webpack_require__.r(__webpack_exports__);
});
});
}
},
computed: {
authError: function authError() {
return this.$store.getters.authError;
}
}
});
......@@ -43610,71 +43623,90 @@ var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("div", { staticClass: "login row justify-content-center" }, [
_c(
"div",
{ staticClass: "col-md-4" },
[
_c(
"v-card",
{ attrs: { flat: "" } },
[
_c("v-card-title", { attrs: { "primary-title": "" } }, [
_c("h4", [_vm._v("Wear Right")])
]),
_vm._v(" "),
_c(
"v-form",
{
on: {
submit: function($event) {
$event.preventDefault()
return _vm.authenticate($event)
}
}
},
[
_c("v-text-field", {
attrs: {
"prepend-icon": "person",
name: "Email",
label: "Sähköposti"
}
}),
_vm._v(" "),
_c("v-text-field", {
attrs: {
"prepend-icon": "lock",
name: "Password",
label: "Salasana",
type: "password"
return _c(
"v-layout",
{ attrs: { row: "", wrap: "" } },
[
_c(
"v-flex",
{ attrs: { xs12: "", "offset-md4": "", md4: "" } },
[
_c(
"v-card",
{ attrs: { flat: "", color: "transparent" } },
[
_c("v-card-title", { attrs: { "primary-title": "" } }, [
_c("h4", [_vm._v("Wear Right")])
]),
_vm._v(" "),
_c(
"v-form",
{
on: {
submit: function($event) {
$event.preventDefault()
return _vm.authenticate($event)
}
}
}),
_vm._v(" "),
_c(
"v-card-actions",
[
_c(
"v-btn",
{
attrs: { primary: "", large: "", block: "" },
on: { click: _vm.authenticate }
},
[
_c("v-text-field", {
attrs: {
"prepend-icon": "person",
name: "email",
label: "Sähköposti"
},
model: {
value: _vm.form.email,
callback: function($$v) {
_vm.$set(_vm.form, "email", $$v)
},
[_vm._v("Kirjaudu sisään")]
)
],
1
)
],
1
)
],
1
)
],
1
)
])
expression: "form.email"
}
}),
_vm._v(" "),
_c("v-text-field", {
attrs: {
"prepend-icon": "lock",
name: "password",
label: "Salasana",
type: "password"
},
model: {
value: _vm.form.password,
callback: function($$v) {
_vm.$set(_vm.form, "password", $$v)
},
expression: "form.password"
}
}),
_vm._v(" "),
_c(
"v-card-actions",
[
_c(
"v-btn",
{
attrs: { primary: "", large: "", block: "" },
on: { click: _vm.authenticate }
},
[_vm._v("Kirjaudu sisään")]
)
],
1
)
],
1
)
],
1
)
],
1
)
],
1
)
}
var staticRenderFns = []
render._withStripped = true
......@@ -114202,10 +114234,10 @@ var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
/***/ (function(module, exports, __webpack_require__) {
window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
*/
try {
......@@ -114214,19 +114246,19 @@ try {
__webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
} catch (e) {}
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Next we will register the CSRF Token as a common header with Axios so that
* all outgoing HTTP requests automatically have it attached. This is just
* a simple convenience so we don't have to attach every token manually.
/**
* Next we will register the CSRF Token as a common header with Axios so that
* all outgoing HTTP requests automatically have it attached. This is just
* a simple convenience so we don't have to attach every token manually.
*/
var token = document.head.querySelector('meta[name="csrf-token"]');
......@@ -114236,10 +114268,10 @@ if (token) {
} else {
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from 'laravel-echo'
// window.Pusher = require('pusher-js');
<template>
<div class="login row justify-content-center">
<v-layout row wrap>
<v-flex xs12 offset-md4 md4>
<!--<div class="login row justify-content-center">
<div class="col-md-4">
<!-- <div class="card">
<div class="card">
<div class="card-header">login</div>
<div class="card-body">
<form @submit.prevent="authenticate">
......@@ -16,24 +18,29 @@
<div class="form-group row">
<input type="submit" value="Kirjaudu sisään" />
</div>
<div class="form-group row" v-if="authError">
<p class="auth-error"> {{ authError }} </p>
</div>
</form>
</div>
</div>-->
<v-card flat>
<v-card flat color="transparent">
<v-card-title primary-title>
<h4>Wear Right</h4>
</v-card-title>
<v-form @submit.prevent="authenticate">
<v-text-field prepend-icon="person" name="Email" label="Sähköposti"></v-text-field>
<v-text-field prepend-icon="lock" name="Password" label="Salasana" type="password"></v-text-field>
<v-text-field v-model="form.email" prepend-icon="person" name="email" label="Sähköposti"></v-text-field>
<v-text-field v-model="form.password" prepend-icon="lock" name="password" label="Salasana" type="password"></v-text-field>
<v-card-actions>
<v-btn @click="authenticate" primary large block>Kirjaudu sisään</v-btn>
</v-card-actions>
</v-form>
</v-card>
</v-flex>
</v-layout>
</div>
</div>
</template>
......@@ -47,21 +54,26 @@
form: {
email: '',
password: ''
}
},
error: null
};
},
methods: {
authenticate() {
this.$store.dispatch('login');
login(this.$data.form)
.then((res) => {
this.$store.commit("loginSuccess", res);
this.$router.push({path: '/'});
})
.catch((error) => {
this.$store.commit("loginFailed", {error});
});
authenticate() {
this.$store.dispatch('login');
login(this.$data.form)
.then((res) => {
this.$store.commit("loginSuccess", res);
this.$router.push({path: '/'});
})
.catch((error) => {
this.$store.commit("loginFailed", {error});
});
}
},
computed: {
authError() {
return this.$store.getters.authError
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment