2018-03-08 09:41:39 +01:00
|
|
|
<template>
|
|
|
|
<div id="authorize">
|
2018-03-20 14:12:06 +01:00
|
|
|
<div class="close">
|
|
|
|
<el-button type="text" @click="close">
|
|
|
|
<i class="el-icon-close"></i>
|
|
|
|
</el-button>
|
|
|
|
</div>
|
2018-03-14 08:14:03 +01:00
|
|
|
<el-form ref="form" :model="authorizeForm" label-width="120px" label-position="top" class="authorize-form" v-on:submit.prevent="authorizeSubmit">
|
2018-03-08 09:41:39 +01:00
|
|
|
<el-form-item label="Please paste authorization code from your browser:">
|
|
|
|
<el-input v-model="authorizeForm.code"></el-input>
|
|
|
|
</el-form-item>
|
2018-03-22 07:17:31 +01:00
|
|
|
<!-- Dummy form to guard submitting with enter -->
|
|
|
|
<el-form-item class="hidden">
|
|
|
|
<el-input></el-input>
|
|
|
|
</el-form-item>
|
2018-03-08 09:41:39 +01:00
|
|
|
<el-form-item class="submit">
|
2018-03-22 07:17:31 +01:00
|
|
|
<el-button type="primary" @click="authorizeSubmit">Submit</el-button>
|
2018-03-08 09:41:39 +01:00
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
name: 'authorize',
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
authorizeForm: {
|
|
|
|
code: ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
authorizeSubmit () {
|
|
|
|
this.$store.dispatch('Authorize/submit', this.authorizeForm.code)
|
2018-03-08 16:24:18 +01:00
|
|
|
.then((id) => {
|
2018-03-09 07:21:25 +01:00
|
|
|
this.$router.push({ path: `/${id}/home` })
|
2018-03-08 16:24:18 +01:00
|
|
|
})
|
2018-03-13 14:25:31 +01:00
|
|
|
.catch(() => {
|
|
|
|
this.$message({
|
|
|
|
message: 'Could not authorize the code',
|
|
|
|
type: 'error'
|
|
|
|
})
|
|
|
|
})
|
2018-03-20 14:12:06 +01:00
|
|
|
},
|
|
|
|
close () {
|
|
|
|
return this.$router.push({ path: '/' })
|
2018-03-08 09:41:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2018-03-09 08:14:47 +01:00
|
|
|
<style lang="scss">
|
2018-03-25 14:14:12 +02:00
|
|
|
body { font-family: 'Noto Sans', 'Source Sans Pro', sans-serif; }
|
2018-03-09 08:14:47 +01:00
|
|
|
|
2018-03-10 15:11:27 +01:00
|
|
|
html, body, #app, #authorize {
|
|
|
|
height: 100%;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
2018-03-08 09:41:39 +01:00
|
|
|
#authorize {
|
2018-03-10 15:11:27 +01:00
|
|
|
background-color: #292f3f;
|
|
|
|
color: #ffffff;
|
2018-03-08 09:41:39 +01:00
|
|
|
text-align: center;
|
2018-03-10 15:11:27 +01:00
|
|
|
|
2018-03-20 14:58:50 +01:00
|
|
|
.close {
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
|
2018-03-10 15:11:27 +01:00
|
|
|
.authorize-form {
|
|
|
|
width: 500px;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-form-item__label {
|
|
|
|
color: #f0f3f9;
|
|
|
|
}
|
|
|
|
|
|
|
|
.el-input__inner {
|
|
|
|
background-color: #373d48;
|
|
|
|
color: #ffffff;
|
|
|
|
border: 0;
|
|
|
|
}
|
2018-03-22 07:17:31 +01:00
|
|
|
|
|
|
|
.hidden {
|
|
|
|
display: none;
|
|
|
|
}
|
2018-03-08 09:41:39 +01:00
|
|
|
}
|
|
|
|
</style>
|