-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathlogin.html
More file actions
141 lines (134 loc) · 6.75 KB
/
login.html
File metadata and controls
141 lines (134 loc) · 6.75 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 lang="en">
<head>
<title>(Bibliographic Framework Initiative Technical Site - BIBFRAME.ORG - Login)</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/png" href="/static/images/favicon.ico">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="/css/bootstrap-theme.min.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="//oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.js"></script>
<!--<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>-->
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
<script src="//cdn.datatables.net/1.10.9/js/jquery.dataTables.js"></script>
<link rel="stylesheet" href="//cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="bfe/builds/bfe.css">
<style>
@media screen {
body {
padding-top: 50px;
padding-bottom: 20px;
}
}
@media print {
a[href]:after {
content: none;
}
}
.login-form {
width: 340px;
margin: 30px auto;
}
</style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">BIBFRAME Editor Demo</a>
</div>
</div>
</nav>
<div class="container">
<div id="loginbox" style="margin-top:50px;" class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2">
<div class="panel panel-info">
<div class="panel-heading">
<div class="panel-title">Sign In</div>
<!-- <div style="float:right; font-size: 80%; position: relative; top:-10px"><a href="#">Forgot password?</a></div> -->
</div>
<div style="padding-top:30px" class="panel-body">
<div style="display:none" id="login-alert" class="alert alert-danger col-sm-12"></div>
<form id="loginform" class="form-horizontal" role="form">
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input id="username" type="text" class="form-control" name="username" value="" placeholder="username">
</div>
<div style="margin-bottom: 25px" class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input id="password" type="password" class="form-control" name="password" placeholder="password">
</div>
<div style="margin-top:10px" class="form-group">
<div class="col-sm-12 controls">
<a id="login-local" href="#" class="btn btn-success">Login </a>
<a id="login-ldap" href="#" class="btn btn-primary" data-auth="ldap">Login with LDAP </a>
<a id="login-cancel" href="#" class="btn btn-default">Cancel </a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
var goBack = document.referrer;
$(document).on("click", ".btn", function (e) {
e.preventDefault();
if ($(this.id).selector == "login-cancel") {
document.location = goBack;
} else {
var authType = $(this.id).selector;
var authUrl = (authType == "login-ldap") ? "/verso/auth/ldap" : "/verso/api/Users/login";
$.ajax ({
url: authUrl,
type: "POST",
data: JSON.stringify({
username: $("#username").val(),
password: $("#password").val()
}),
contentType: "application/json; charset=utf-8",
error: function(x) {
alert(JSON.parse(x.responseText).error.message);
$("#username").val("");
$("#password").val("");
},
success: function() {
if (!document.cookie.match(/access_token=|current_user=/)) {
alert('Login failed');
$("#username").val("");
$("#password").val("");
} else {
if (authType == "login-ldap") {
var user = $("#username").val();
var cookValue = encodeURIComponent('{"username":"' + user + '"}');
document.cookie = 'current_user=' + cookValue;
}
document.location = goBack;
};
},
});
};
});
</script>
<hr>
<footer class="bs-footer" role="contentinfo">
<div class="container">
<p>This is a development view of the Bibliographic Framework Initiative project's editor. For more information, go to <a href="http://www.loc.gov/bibframe/">www.loc.gov/bibframe</a>.</p>
</div>
</footer>
</body>
</html>