File: unsubscriptionConfirmation.html

package info (click to toggle)
zaqar 21.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,964 kB
  • sloc: python: 28,819; sh: 513; java: 135; makefile: 63; javascript: 50
file content (145 lines) | stat: -rw-r--r-- 4,639 bytes parent folder | download | duplicates (4)
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
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>

<style>
html, body {
    margin: 0; padding: 0;
    background: #fff;
    color: #333;
    font: 12px/15px Verdana, sans-serif;
}
#container {
    max-width: 520px;
    margin: 30px;
    padding: 0px;

}
#content h2 {
    font: bold 16px/16px Verdana, sans-serif;
    margin: 0;
    padding: 0;
    margin-bottom: 12px;
}
#header {
    height: 40px;
    padding-bottom: 0;
    color: #e47911;
    position:relative;
    margin-bottom: 12px;
}
#header h1 {
    font-size: 12px;
    line-height: 12px;
    margin: 0; padding: 0;
    position: absolute;
    bottom: 0;
    right: 0;
}
#content {
    padding: 12px;
    background: #ecf5fb;
    border: 1px solid #c9e1f4;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
}
p {
    margin-top: 0;
    margin-bottom: 12px;
}
.error {
    color: #900;
}
.success {
    color: #090;
}
code {
    font-style: normal;
    color: #000;
}
abbr {
    font-weight: bold;
}
a:visited, a:hover {
    color: #004b91;
}
</style>
</head>
<body>
<div id="container">
<div id="header">
<h1>OpenStack Zaqar Service</h1>
</div>
<div id="content">
<h2 id="status">Removing subscription...</h2>
<div id="progress">
<noscript><p>Your browser has JavaScript disabled. <i>To confirm a subscription via this page, your browser must have JavaScript enabled.</i></p></noscript>
</div>
</div>
</div>

<script type="text/javascript">
function getParameterByName( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

$(document).ready(function(){
    var confirmationUrl = getParameterByName("Url");
    var Signature = getParameterByName("Signature");
    var Methods = getParameterByName("Methods");
    var Paths = getParameterByName("Paths");
    var Project = getParameterByName("Project");
    var Expires = getParameterByName("Expires");
    var Queue = getParameterByName("Queue");
    var Confirmed = getParameterByName("Confirm");

    var failureString = "<p>Your subscription could not be removed because of an error.</p>";

    if (Queue == "") {
        $("#status").html("Subscription <i>not</i> removed").addClass("error");
        $("#progress").html("<p>Your subscription could not be removed because queue is missing. To unsubscribe, please use the full URL from the message you received.</p>");
    } else {
        var response = $.ajax({ type: "PUT",
                                url: "http://127.0.0.1:5678",
                                dataType: "json",
                                data: {'confirmed': false},
                                beforeSend: function(request) {
                                    request.setRequestHeader("Content-type", "application/json");
                                    request.setRequestHeader("URL-Signature", Signature);
                                    request.setRequestHeader("URL-Methods", Methods);
                                    request.setRequestHeader("URL-Paths", Paths);
                                    request.setRequestHeader("X-Project-ID", Project);
                                    request.setRequestHeader("URL-Expires", Expires);
                                    request.setRequestHeader("Confirmation-Url", confirmationUrl);
                                    request.setRequestHeader("Confirm", Confirmed);
                                },
                                success: function(data, status, req){
                                    $("#status").html("Subscription removed!").addClass("success");
                                    $("#progress").html("<p>You have removed subscription to the queue:<br /><abbr title=\""
                                        + Queue
                                        + "\">"
                                        + Queue
                                        + "</abbr>.</p>");
                                    },
                                error: function(req, status, error){
                                    $("#status").html("Subscription <i>not</i> removed").addClass("error");
                                    $("#progress").html(failureString);
                                }
                              });
        }
    }
);
</script>

</body>
</html>