-
Notifications
You must be signed in to change notification settings - Fork 9
/
login.js
68 lines (55 loc) · 1.31 KB
/
login.js
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
$(function(){
$name = $('#full-name');
$nameerror = $('#nameerror');
$uid = $('#uid');
$uiderror = $('#uiderror');
$email = $('#email');
$emailerror = $('#emailerror');
$pass = $('#password');
$passerror = $('#passerror');
$('#submit_button').click(function(){
$error = 0;
$nameerror.hide();
$uiderror.hide();
$emailerror.hide();
$passerror.hide();
if(($nameval = $.trim($name.val())).length == 0)
{
$error = 1;
$nameerror.show();
}
if(($uidval = $.trim($uid.val())).length == 0)
{
$error = 1;
$uiderror.show();
}
else
{
$uidval = $uidval.replace(/\s+/g, '');
}
if(($emailval = $.trim($email.val())).length == 0)
{
$error = 1;
$emailerror.show();
}
else if(!(/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test($emailval)))
{
$error = 1;
$emailerror.show();
}
if(($passval = $.trim($pass.val())).length == 0)
{
$error = 1;
$passerror.show();
}
if(!$error)
{
console.log($nameval);
console.log($uidval);
Cookies.set('name', $nameval);
Cookies.set('uid', $uidval);
console.log(Cookies.get('name'));
location.href = 'profile.html';
}
});
});