Commit 39937d47 authored by Kittisak Maneewong's avatar Kittisak Maneewong

update login

parent caa1a8dc
This diff is collapsed.
...@@ -2,98 +2,88 @@ ...@@ -2,98 +2,88 @@
<div> <div>
<v-container grid-list-md text-xs-center> <v-container grid-list-md text-xs-center>
<v-layout row wrap> <v-layout row wrap>
<v-flex xs12 sm4 offset-sm1 align-center py-2> <v-flex xs12 sm4 offset-sm1 align-center>
<div class="text-sm-left mb-4">
<span class="headline font-weight-bold">เข้าสู่ระบบ</span>
</div>
<v-form @submit.prevent="login()"> <v-form @submit.prevent="login()">
<div class="text-sm-left">
<span class="headline font-weight-bold">เข้าสู่ระบบ</span>
</div>
<v-text-field <v-text-field
label="อีเมล" label="อีเมล"
prepend-inner-icon="email" prepend-inner-icon="email"
color="primary" color="primary"
class="fix-size red--text" class="fix-size red--text"
type="email" type="email"
v-model="user.email" v-model="loginData.email"
></v-text-field> ></v-text-field>
<v-text-field <v-text-field
label="รหัสผ่าน" label="รหัสผ่าน"
type="password" type="password"
color="primary" color="primary"
prepend-inner-icon="lock" prepend-inner-icon="lock"
v-model="user.password" v-model="loginData.password"
></v-text-field> ></v-text-field>
<p class="text-xs-right"><a href="#" class="body-2 font-weight-medium">ลืมรหัสผ่าน?</a></p> <p class="text-xs-right"><router-link to="/" class="body-2 font-weight-medium">ลืมรหัสผ่าน?</router-link></p>
<v-btn color="blue" block dark large type="submit">เข้าสู่ระบบ</v-btn> <v-btn color="blue" large dark block type="submit">เข้าสู่ระบบ</v-btn>
</v-form> </v-form>
<v-layout row wrap align-center justify-center> <div class="my-3"><span class="font-weight-bold">หรือ</span></div>
<v-flex sm5> <v-btn color="primary" block><v-icon>fab fa-facebook</v-icon>&nbsp;เข้าสู่ระบบ Facebook</v-btn>
<v-divider></v-divider> <v-btn color="deep-orange" class="white--text" block><v-icon>fab fa-google</v-icon>&nbsp;เข้าสู่ระบบ Google</v-btn>
</v-flex> </v-flex>
<v-flex sm2> <v-flex sm2 xs12>
หรือ <v-layout justify-center fill-height>
</v-flex> <v-divider vertical inset></v-divider>
<v-flex sm5>
<v-divider></v-divider>
</v-flex>
</v-layout>
<v-layout row wrap>
<v-flex sm6>
<v-btn color="primary" block><v-icon>fab fa-facebook</v-icon>&nbsp;เข้าสู่ระบบ Facebook</v-btn>
</v-flex>
<v-flex sm6>
<v-btn color="deep-orange" class="white--text" block><v-icon>fab fa-google</v-icon>&nbsp;เข้าสู่ระบบ Google</v-btn>
</v-flex>
</v-layout> </v-layout>
</v-flex> </v-flex>
<v-flex sm4 offset-sm1 xs12 align-center py-2> <v-flex sm4 xs12 align-center>
<div class="text-sm-left"> <div class="text-sm-left mb-4">
<span class="headline font-weight-bold">สมัครสมาชิก</span> <span class="headline font-weight-bold">สมัครสมาชิก</span>
</div> </div>
<v-layout row wrap> <v-form @submit.prevent="register()">
<v-flex sm6 xs12> <v-layout row wrap>
<v-text-field <v-flex sm6 xs12>
label="ชื่อ" <v-text-field
v-model="ชื่อ" label="ชื่อ"
clearable v-model="registerData.first_name"
required clearable
class="fix-size" required
></v-text-field> class="fix-size"
</v-flex> ></v-text-field>
<v-flex sm6 xs12> </v-flex>
<v-text-field <v-flex sm6 xs12>
label="นามสกุล" <v-text-field
v-model="นามสกุล" label="นามสกุล"
clearable v-model="registerData.last_name"
required clearable
class="fix-size" required
></v-text-field> class="fix-size"
</v-flex> ></v-text-field>
</v-layout> </v-flex>
<v-text-field </v-layout>
label="อีเมล" <v-text-field
v-model="อีเมล" label="อีเมล"
clearable v-model="registerData.email"
required clearable
class="fix-size" required
></v-text-field> class="fix-size"
<v-text-field ></v-text-field>
label="รหัสผ่าน" <v-text-field
v-model="รหัสผ่าน" label="รหัสผ่าน"
clearable v-model="registerData.password"
type="password" clearable
required type="password"
class="fix-size" required
></v-text-field> class="fix-size"
<v-text-field ></v-text-field>
label="ยืนยันรหัสผ่าน" <v-text-field
v-model="ยืนยันรหัสผ่าน" label="ยืนยันรหัสผ่าน"
clearable v-model="registerData.password_confirmation"
type="password" clearable
required type="password"
class="fix-size" required
></v-text-field> class="fix-size"
<v-btn color="red accent-3" block dark large>สมัครสมาชิก</v-btn> ></v-text-field>
<v-btn color="red accent-3 my-4" block dark large type="submit">สมัครสมาชิก</v-btn>
</v-form>
</v-flex> </v-flex>
</v-layout> </v-layout>
</v-container> </v-container>
...@@ -104,17 +94,55 @@ ...@@ -104,17 +94,55 @@
export default { export default {
data () { data () {
return { return {
user: { loginData: {
email: '', email: '',
password: '' password: ''
},
registerData: {
first_name: '',
last_name: '',
email: '',
password: '',
password_confirmation: ''
} }
} }
}, },
methods: { methods: {
login () { login () {
console.log('login') axios.post('/login', this.loginData)
axios.post('/login', this.user) .then((res) => {
console.log(res)
console.log(res.body)
this.$router.push('/')
})
.catch((err) => {
console.log(err.response)
})
},
register () {
axios.post('/register', {
name: this.registerData.first_name + ' ' + this.registerData.last_name,
email: this.registerData.email,
password: this.registerData.password,
password_confirmation: this.registerData.password_confirmation
})
.then((res) => {
this.$router.push('/account');
console.log(res)
})
.catch((err) => {
console.log(err.response)
})
} }
},
mounted () {
axios.get('api/user')
.then((res) => {
console.log(res.body)
})
.catch((err) => {
console.log(err.response)
})
} }
} }
</script> </script>
......
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