Commit 202af87d by Nguyễn Đức Huy

Login

parent 9ff8fbd4
Pipeline #1135 canceled with stages
in 0 seconds
...@@ -7,26 +7,31 @@ ...@@ -7,26 +7,31 @@
</div> </div>
<h1 class="fadein second">Login</h1> <h1 class="fadein second">Login</h1>
<!-- Login Form --> <!-- Login Form -->
<form @submit.prevent="onSubmit">
<input <input
id="login" id="email"
v-model="username" v-model="email"
type="text" type="text"
class="fadein second" class="fadein second"
name="login" name="email"
placeholder="login" placeholder="Email"
/> />
<input <input
id="password" id="password"
v-model="password" v-model="password"
type="password" type="password"
class="fadein third" class="fadein third"
name="login" name="password"
placeholder="password" placeholder="Password"
/> />
<button type="submit" class="fadein fourth" value="Log In"> <button type="submit" class="fadein fourth" value="Log In">
Submit Submit
</button> </button>
</form>
<div class="fadein third">
New to ChatChat?
<nuxt-link to="/register">Create an account.</nuxt-link>
</div>
<!-- Remind Passowrd --> <!-- Remind Passowrd -->
<!-- <div id="formFooter"> <!-- <div id="formFooter">
<a class="underlineHover" href="#">Forgot Password?</a> <a class="underlineHover" href="#">Forgot Password?</a>
...@@ -44,13 +49,29 @@ export default { ...@@ -44,13 +49,29 @@ export default {
data() { data() {
return { return {
checkLogin: true, checkLogin: true,
username: '', email: '',
password: '', password: '',
error: null, error: null,
} }
}, },
methods: {}, methods: {
onSubmit() {
this.$axios
.$post(
'https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=AIzaSyA0qXrqxpNc5FuQ_PE9D2bE4nlmPTuFAnc',
{
email: this.email,
password: this.password,
returnSecureToken: true,
}
)
.then((result) => {
alert('Login Success !')
// window.location.href = '/'
})
},
},
} }
</script> </script>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
type="text" type="text"
class="fadein second" class="fadein second"
name="email" name="email"
placeholder="email" placeholder="Email"
/> />
<input <input
id="password" id="password"
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
type="password" type="password"
class="fadein third" class="fadein third"
name="password" name="password"
placeholder="password" placeholder="Password"
/> />
<input <input
id="repassword" id="repassword"
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
type="password" type="password"
class="fadein third" class="fadein third"
name="repassword" name="repassword"
placeholder="rePassword" placeholder="Re Password"
/> />
<button type="submit" class="fadein fourth" value="Log In"> <button type="submit" class="fadein fourth" value="Log In">
Submit Submit
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
<!-- <div id="formFooter"> <!-- <div id="formFooter">
<a class="underlineHover" href="#">Forgot Password?</a> <a class="underlineHover" href="#">Forgot Password?</a>
</div> --> </div> -->
<div class="fadein third">
Have your account? Login <nuxt-link to="/login">here</nuxt-link>
</div>
</div> </div>
</div> </div>
<div v-else>TEST</div> <div v-else>TEST</div>
...@@ -48,8 +51,6 @@ ...@@ -48,8 +51,6 @@
<script> <script>
export default { export default {
name: 'Login',
layout: 'clean',
data() { data() {
return { return {
checkLogin: true, checkLogin: true,
...@@ -80,6 +81,7 @@ export default { ...@@ -80,6 +81,7 @@ export default {
window.location.href = '/' window.location.href = '/'
}) })
} else { } else {
alert("repassword don't match with password")
} }
}, },
}, },
......
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