2018-10-26 13:16:23 +00:00
|
|
|
import oauthApi from "../../services/new_api/oauth.js";
|
2016-10-27 16:02:41 +00:00
|
|
|
const LoginForm = {
|
|
|
|
data: () => ({
|
2017-03-08 17:28:41 +00:00
|
|
|
user: {},
|
|
|
|
authError: false
|
2016-10-27 16:02:41 +00:00
|
|
|
}),
|
|
|
|
computed: {
|
2017-06-20 07:37:51 +00:00
|
|
|
loggingIn () { return this.$store.state.users.loggingIn },
|
2018-09-09 18:21:23 +00:00
|
|
|
registrationOpen () { return this.$store.state.instance.registrationOpen }
|
2016-10-27 16:02:41 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2018-10-26 13:16:23 +00:00
|
|
|
oAuthLogin () {
|
|
|
|
oauthApi.login({
|
|
|
|
oauth: this.$store.state.oauth,
|
|
|
|
instance: this.$store.state.instance.server,
|
|
|
|
commit: this.$store.commit
|
|
|
|
});
|
|
|
|
},
|
2016-10-27 16:02:41 +00:00
|
|
|
submit () {
|
2017-03-08 17:28:41 +00:00
|
|
|
this.$store.dispatch('loginUser', this.user).then(
|
2017-03-09 07:51:33 +00:00
|
|
|
() => {},
|
2017-03-08 18:22:56 +00:00
|
|
|
(error) => {
|
|
|
|
this.authError = error
|
2017-03-08 18:08:01 +00:00
|
|
|
this.user.username = ''
|
|
|
|
this.user.password = ''
|
|
|
|
}
|
2017-03-08 17:28:41 +00:00
|
|
|
)
|
2016-10-27 16:02:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default LoginForm
|