-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
185 lines (158 loc) · 7.28 KB
/
index.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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Taskficien</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="Assets/Style/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="Assets/Style/taskficien.css" rel="stylesheet">
<link href="Assets/Style/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="bootstrap/js/html5shiv.js"></script>
<![endif]-->
<!-- Fav and touch icons -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="Assets/Style/bootstrap/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="Assets/Style/bootstrap/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="Assets/Style/bootstrap/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="Assets/Style/bootstrap/ico/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon" href="Assets/Style/bootstrap/ico/favicon.ico">
<script src="http://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript" language="JavaScript" ></script>
<script src="http://underscorejs.org/underscore-min.js" type="text/javascript" language="JavaScript" ></script>
<script src="http://backbonejs.org/backbone-min.js" type="text/javascript" language="JavaScript" ></script>
<script src="Assets/Scripts/backbone.js" type="text/javascript" language="JavaScript" ></script>
<script src="Assets/Scripts/taskficien.js" type="text/javascript" language="JavaScript" ></script>
<script src="Assets/Scripts/common.js" type="text/javascript" language="JavaScript" ></script>
<script type='text/javascript' src="http://cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.1/jquery.xdomainrequest.min.js"></script>
<!-- load javascript function -->
<script src="Assets/Scripts/user.js" type="text/javascript" language="JavaScript" ></script>
<script>
var isLoggedIn = readCookie("isLoggedIn");
if (isLoggedIn == "true"){
window.location = "dashboard.html";
}
</script>
</head>
<body>
<div class="container" style="padding-top:80px;">
<div class="row-fluid">
<div class="span12" style="text-align:center">
<img id="logo" src="Assets/Images/tf_logo.png" title="Tasficien" style="width: 30%;height: 30%;display:show;"/>
</div>
</div>
<div class="row-fluid">
<div class="span3" style="text-align:center">
</div>
<div class="span6" style="text-align:center">
<div id="msgArea">
</div>
</div>
<div class="span3" style="text-align:center">
</div>
</div>
<div class="row-fluid">
<div class="span3" style="text-align:center">
</div>
<div class="span6" style="text-align:center">
<a href="#loginModal" role="button" data-toggle="modal"><img id="btnLogin" src="Assets/Images/tf_btn_login.png" title="Login" style="width: 50%;height: 50%;display:show;cursor:pointer;"/></a>
</div>
<div class="span3" style="text-align:center">
<!-- Modal -->
<div id="loginModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<p id="myModalLabel"><strong>Login</strong> to Taskficien</p>
</div>
<div class="modal-body">
<div id="loginForm">
<form class="form-horizontal" action="http://192.168.0.109:8000/api/v1/user/login/" method="POST" >
<div class="control-group">
<label class="control-label" for="inputEmail">Username</label>
<div class="controls">
<input type="text" name="username" id="username" placeholder="Username" value="" class="text ui-widget-content ui-corner-all">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputEmail">Password</label>
<div class="controls">
<input type="password" name="password" id="password" value="" placeholder="Password" class="text ui-widget-content ui-corner-all">
<input type="hidden" name="format" id="format" value="json" class="text ui-widget-content ui-corner-all">
</div>
</div>
</form>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary" onClick="doLogin()">Login</button>
</div>
</div>
</div>
</div>
</div> <!-- /container -->
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="Assets/Style/bootstrap/js/bootstrap-transition.js"></script>
<script src="Assets/Style/bootstrap/js/bootstrap-alert.js"></script>
<script src="Assets/Style/bootstrap/js/bootstrap-modal.js"></script>
<script src="Assets/Style/bootstrap/js/bootstrap-dropdown.js"></script>
<script src="Assets/Style/bootstrap/js/bootstrap-scrollspy.js"></script>
<script src="Assets/Style/bootstrap/js/bootstrap-tab.js"></script>
<script src="Assets/Style/bootstrap/js/bootstrap-tooltip.js"></script>
<script src="Assets/Style/bootstrap/js/bootstrap-popover.js"></script>
<script src="Assets/Style/bootstrap/js/bootstrap-button.js"></script>
<script src="Assets/Style/bootstrap/js/bootstrap-collapse.js"></script>
<script src="Assets/Style/bootstrap/js/bootstrap-carousel.js"></script>
<script src="Assets/Style/bootstrap/js/bootstrap-typeahead.js"></script>
<script>
(function($){
//$("#logo").show({effect: "fade", duration: 1000});
/*$("#btnLogin").on("click", function(){
//$(this).parent().html($("#loginForm").html());
$("#loginForm").show({effect: "fade", duration: 700});
$(this).on("click", doLogin);
});*/
//loading("hide");
})(jQuery);
function doLogin(){
//loading("show");
var contentType ="application/json";
if(window.XDomainRequest) //for IE8,IE9
contentType = "text/plain";
var username = $("[name=username]").last().val();
var password = $("[name=password]").last().val();
$.ajax({
url: apiUrl + "user/login/",
type: "POST",
dataType: "json",
contentType: contentType,
data: JSON.stringify({
"username": username,
"password": password
}),
success: function(data,status){
var json = eval(data.user);
var user = json[0].fields;
writeCookie("sessionId", json[0].pk, 1);
writeCookie("username", username, 1);
writeCookie("password", password, 1);
writeCookie("isLoggedIn", true, 1);
writeCookie("Authorization", "Basic " + btoa(username + ":" + password), 1);
window.location = "user.html";
},
error:function(jqXHR,textStatus,errorThrown)
{
//loading("hide");
//showMessageAlert("You can not send Cross Domain AJAX requests: "+errorThrown);
//alert("You can not send Cross Domain AJAX requests: "+errorThrown);
},
complete: function(){
}
});
}
</script>
</body>
</html>