-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.html
94 lines (81 loc) · 2.85 KB
/
register.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!doctype html>
<html lang="en">
<head>
<title>Sign Up</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
</head>
<body class="img js-fullheight" >
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="card">
<form onsubmit="event.preventDefault()" class="box">
<h1>Sign Up</h1>
<p> Please enter your login and password!</p>
<input id="first-name" type="text" name="" placeholder="First-name">
<input id="Last-name" type="text" name="" placeholder="Last-name">
<input type="text" name="" placeholder="Username">
<input id="email" type="text" name="" placeholder="E-mail">
<input id="pass" type="password" name="" placeholder="Password">
<input id="pass" type="password" name="" placeholder="confirm-Password">
<a class="forgot" href="#">Forgot password?</a>
<input id="submit" type="submit" name="" value="Login" href="#">
<!-- <div class="col-md-12">
<ul class="social-network social-circle">
<li><a href="#" class="icoFacebook" title="Facebook"><i
class="fab fa-facebook-f"></i></a></li>
<li><a href="#" class="icoTwitter" title="Twitter"><i class="fab fa-twitter"></i></a>
</li>
<li><a href="#" class="icoGoogle" title="Google +"><i
class="fab fa-google-plus"></i></a></li>
</ul>
</div> -->
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript">
const api_url = "https://reqres.in/api/register";
document.getElementById("submit").addEventListener("click", function(event){
const email = document.getElementById("email").value;
const pass = document.getElementById("pass").value;
event.preventDefault()
if(email==""|| pass==""){
alert("please fill Email And Password");
return false;
}
getUser(email,pass);
});
async function getUser(email,pass) {
const response = await fetch(api_url, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body:JSON.stringify({
email:email,
password:pass,
}),
});
let result = await response.json();
console.log(result);
if(!result.error){
alert("Register success");
window.location="login.html";
}else{
alert(result.error);
}
}
</script>
<script src="js/jquery.min.js"></script>
<script src="js/popper.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>