-
Notifications
You must be signed in to change notification settings - Fork 1
/
signup.html
113 lines (107 loc) · 6.5 KB
/
signup.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/[email protected]/dist/sweetalert.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/build/css/alertify.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/build/css/themes/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/build/alertify.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/Parking-Master/Simple-Alert@latest/simplealert.js"></script>
<meta http-equiv="X-Frame-Options" content="deny">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
<title>Signup for Parking Master</title>
<style>input{color:#fff!important;background:#ddd!important;}::selection{background-color:#ddd;color:#f9f9f9}input:-webkit-autofill{-webkit-box-shadow:0 0 0px 1000px #ddd inset}body{caret-color:#333;-webkit-tap-highlight-color:transparent;font-family:Arial,Helvetica,sans-serif}*{box-sizing:border-box}input[type=email],input[type=text],input[type=password]{width:100%;padding:15px;margin:5px 0 22px 0;display:inline-block;border:none;background:#f1f1f1}input[type=password]:focus,input[type=text]:focus{background-color:#ddd;outline:0}button{background-color:#333;color:#fff;padding:14px 20px;margin:8px 0;border:none;cursor:pointer;width:100%;opacity:.9;border-radius:2px}button:hover{opacity:1}.cancelbtn{padding:14px 20px;background-color:#f44336}.signupbtn{float:center;width:100%;position:relative;left:50%;margin-left:-50%}.container{padding:16px}.modal{display:block;position:fixed;z-index:1;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:transparent;padding-top:50px}.modal-content{background-color:#fefefe;margin:5% auto 15% auto;width:90%}hr{border:1px solid #f1f1f1;margin-bottom:25px}.clearfix::after{content:"";clear:both;display:table}@media screen and (max-width:300px){.signupbtn{width:100%}}</style>
<script type="text/javascript" src="https://npmcdn.com/parse/dist/parse.min.js"></script>
<script src="https://www.google.com/recaptcha/api.js?onload=onReady"></script>
</head>
<body>
<div class="modal">
<form class="modal-content" action="signup.html" onsubmit="event.preventDefault();">
<div class="container">
<h1 style="text-align:center;font-style:normal;font-family:'Verdana', Verdana, 'Lato', 'Roboto', 'Open sans', Arial, sans-serif;color:#ddd;">Sign up</h1>
<div style="color:#ddd;text-align:center;"><a style="text-decoration:none;color:#ddd;border-bottom:0.006vw solid #ddd;" href="https://parkingmaster-2.w3spaces.com/help.html">Help</a> • <a style="text-decoration:none;color:#ddd;border-bottom:0.006vw solid #ddd;" href="login.html">Login instead</a></div>
<hr>
<label for="email" style="color:#ddd;"><b>Username</b></label>
<input autocorrect="off" spellcheck="false" autocomplete="off" id="email-val" type="text" placeholder="Create Username" name="email" required style="outline:none!important;">
<label for="psw" style="color:#ddd;"><b>Password</b></label>
<input autocorrect="off" spellcheck="false" autocomplete="off" id="pass-val" type="password" placeholder="Create Password" name="psw" required>
<label for="psw-repeat" style="color:#ddd;"><b>Repeat Password</b></label>
<input autocorrect="off" spellcheck="false" autocomplete="off" type="password" placeholder="Repeat Password" id="psw-repeat" name="psw-repeat" required>
<label style="color:#ddd;">
<input type="checkbox" checked="checked" name="remember" style="margin-bottom:15px"> Remember me
</label>
<br>
<div class="g-recaptcha" data-theme="light" data-sitekey="6LcEhsAfAAAAABaoJv6CDN2VPxwugGGVA93ehC6W" style="display: inline-block;"></div>
<br>
<p style="color:#ddd;">By creating an account you agree to our <a href="https://parkingmaster-2.w3spaces.com/legal/terms-of-use.html" style="color:#ddd">Terms & Privacy</a>.</p>
<hr>
<div class="clearfix">
<button type="submit" class="signupbtn" style="background:#ddd;" onclick="signup()">Sign Up</button>
</div>
</div>
</form>
</div>
<script>
Parse.initialize("n7dcRgc7NMmI9SZtVOIRVif1ZsbzNVZVHIt0UoCZ", "uUO6Phxaq7AKU5rSbPYLJDU1N93yI63BazkMKbee");
Parse.serverURL = "https://parseapi.back4app.com/";
async function signup() {
let username = document.getElementById("email-val").value.trim();
let password = document.getElementById("pass-val").value.trim();
let repeat = document.getElementById("psw-repeat").value.trim();
if (repeat === password && username) {
if (grecaptcha && grecaptcha.getResponse().length > 0) {
let user = new Parse.User();
user.set("username", username);
user.set("password", password);
try {
user = await user.save();
if (user !== null) {
swal({
icon: "success",
title: "Account created!",
text: "User " + username + " added successfully",
button: "Log in",
closeOnClickOutside: false,
closeOnEsc: false
}).then(function() {
location.replace("/login.html");
});
document.querySelector(".swal-button").style.backgroundColor = "#6cc22e";
document.querySelector(".swal-button").style.boxShadow = "none";
}
} catch (err) {
if (err.message.toLowerCase().trim() == "account already exists for this username.") {
swal({
icon: "error",
title: "Error",
text: "An account with this username already exists.",
button: "Close",
closeOnClickOutside: false,
closeOnEsc: false
}).then(function() {
swal.close();
});
document.querySelector(".swal-button").style.backgroundColor = "#ff0000";
document.querySelector(".swal-button").style.boxShadow = "none";
} else {
alert(err.message);
}
}
} else {
swal({
icon: "error",
title: "Error",
text: "Please verify the recaptcha!",
button: "Close",
closeOnClickOutside: false,
closeOnEsc: false
}).then(function() {
swal.close();
});
document.querySelector(".swal-button").style.backgroundColor = "#ff0000";
document.querySelector(".swal-button").style.boxShadow = "none";
}
}
}
</script>
</body>
</html>