forked from snoopysecurity/dvws-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
87 lines (71 loc) · 3.08 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
<script src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/angular.min.js"></script>
<link href="./css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="./js/bootstrap.min.js"></script>
<link href="index.css" rel="stylesheet" id="inline-css">
<!------ Include the above in your HEAD tag ---------->
<div class="sidenav">
<div class="login-main-text">
<h2>Damn Vulnerable Web Services<br> Login Page</h2>
<p>Login or register for Access</p>
</div>
</div>
<div class="main">
<div class="col-md-6 col-sm-12">
<div class="login-form">
<div ng-app="app" ng-controller="MyController">
<p>Username: <input type="text" class="form-control" name="UserName" ng-model="username" required /></p>
<p>Password: <input type="text" class="form-control" name="Password" ng-model="password" required /></p>
<button class="btn btn-black" ng-click="SendData()">Login</button>
<button class="btn btn-secondary" ng-click="SendData2()">Register</button>
<hr />
<div ng-bind-html="DataResponse"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var app = angular.module('app', []).config(function ($sceProvider) {
$sceProvider.enabled(false);
});
app.controller('MyController', function ($scope, $http, $window) {
$scope.SendData = function () {
var post = $http({
method: "POST",
url: "/api/v2/login",
dataType: 'json',
data: 'username=' + $scope.username +'&' + 'password=' + $scope.password,
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
post.success(function (data, status) {
if (data.status == 200) {
$window.localStorage.setItem('JWTSessionID', data.token);
window.location = "home.html#" + data.result.username;
$scope.DataResponse = data.result.username;
}
});
post.error(function (data, status) {
$scope.DataResponse = data.error;
});
}
$scope.SendData2 = function () {
var post = $http({
method: "POST",
url: "/api/v2/users",
dataType: 'json',
data: 'username=' + $scope.username +'&' + 'password=' + $scope.password,
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
post.success(function (data, status) {
if (data.status == 201) {
$scope.DataResponse = data.user + ' created successfully!';
} else if (data.status == 409) {
$scope.DataResponse = data;
}
});
post.error(function (data, status) {
$scope.DataResponse = data;
});
}
});
</script>