-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMain.html
More file actions
141 lines (121 loc) · 4.54 KB
/
Main.html
File metadata and controls
141 lines (121 loc) · 4.54 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html>
<head>
<link href='https://fonts.googleapis.com/css?family=Raleway:700' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script type="text/javascript" src="./js/bignumber.min.js"></script>
<script type="text/javascript" src="./js/crypto-js.js"></script>
<script type="text/javascript" src="./js/utf8.js"></script>
<script type="text/javascript" src="./js/web3.min.js"></script>
<script>
//var user_name = "0x25bfa5c5c3ea5a6d23c5aa89f4dedd5c442a3824";
//var password = "testuser2";
var url = "http://127.0.0.1:8545"
function login(user_name, password) {
// alert("hihi1");
var JSONdata = createJSONdata("personal_unlockAccount", [user_name, password, 30]);
// alert("hihi2");
executeJsonRpc(url, JSONdata, function success(data) {
if (data.error == null) {
alert("success");
console.log("login success!");
location.href='./Pre-condition.html';
}
else {
alert("error");
console.log("login error");
}
}, function error(data) {
console.log("login error");
});
}
function createJSONdata(method, params) {
var JSONdata = {
"jsonrpc": "2.0",
"method": method,
"params": params
};
return JSONdata;
}
function executeJsonRpc(url_exec, JSONdata, success, error) {
$.ajax({
type: 'post',
url: url_exec,
data: JSON.stringify(JSONdata),
contentType: 'application/JSON',
dataType: 'JSON',
scriptCharset: 'utf-8',
success: function(data) {
success(data);
},
error: function(data) {
error(data);
}
});
}
function checkLogin(){
// alert("ddd");
var getId = document.getElementById("userID").value;
var getPwd = document.getElementById("userPassword").value;
login(getId, getPwd);
}
</script>
<style>
@import url(//fonts.googleapis.com/earlyaccess/notosanskr.css);
body,
html {
height: 100%;
font-size: 30px;
font-family: 'Noto Sans KR';
margin: 0;
}
.hero-image {
background-image: url("images/Block2.jpg");
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
}
.hero-text {
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
}
.label,
input,
button {
font-size: 30px;
}
checkbox{
width: 15px;
}
img {
height: 100%;
width: 120px;
}
</style>
</head>
<body>
<div class="hero-image">
<div class="hero-text">
<h1 style="font-size:150px">B Vote</h1>
<div class="container">
<center>
<label for="text">USER ID</label>
<input type="text" placeholder="Enter ID" id="userID" required><br>
<label for="text">PASSWORD</label>
<input type="password" placeholder="Enter Password" id="userPassword" required><br>
<input type="checkbox" checked="checked"> Remember me</input>
<input type="button" value="Log in" onclick="checkLogin();" />
<br><br>
<span class="psw">Forgot <a href="#">password?</a></span><br>
<a href="./signUp.html"> If you don`t have an account...<a></p>
</center>
</div>
</div>
</body>
</html>