-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
164 lines (138 loc) · 8.15 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
<!DOCTYPE HTML>
<html lang="en" id="ng-app" style="display: block;">
<head>
<title>Password Manager</title>
<link rel="stylesheet" href="https://web.telegram.org/css/app.css">
<link rel="stylesheet" href="https://web.telegram.org/css/desktop.css">
<link rel="stylesheet" href="/lib/css/main.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
</head>
<body id="displaySite" style="display:none" class="non_osx non_msie is_1x">
<br><br>
<div class="page_wrap">
<div>
<div class="tg_page_head tg_head_wrap noselect clearfix">
<div class="tg_head_split">
<div class="tg_head_main_wrap"></div>
</div>
</div>
</div>
<div class="im_page_wrap clearfix im_page_peer_not_selected">
<div class="im_page_split clearfix">
<div class="im_dialogs_col_wrap noselect">
<div class="im_dialogs_panel">
<div class="im_dialogs_search">
<input class="form-control im_dialogs_search_field no_outline" type="search" placeholder="Search" autocomplete="off">
<a class="im_dialogs_search_clear tg_search_clear ng-hide">
<i class="icon icon-search-clear"></i>
</a>
<div style="margin-top: 10px;">
<button id="showSite" class="fBtn btn reply_markup_button" style="float: right;width:48%;">Add site</button>
<button id="showAccount" class="fBtn btn reply_markup_button" style="float: right;width:48%;margin-right: 11px;">Add account</button>
</div>
<br style="clear:both;">
</div>
</div>
<div my-dialogs-list="" class="im_dialogs_col" style="height: 492px;">
<div class="im_dialogs_wrap nano has-scrollbar">
<div class="im_dialogs_scrollable_wrap nano-content" tabindex="-1" style="right: -10px;">
<div id="addAccount" style="display:none;padding-top: 0px;padding-bottom: 0px;" class="im_dialogs_panel">
<div class="im_dialogs_search">
<form>
<input style="margin-bottom: 10px;" id="addAccount_url" class="form-control no_outline clearVal" type="text" placeholder="Site URL" autocomplete="off" required>
<input style="margin-bottom: 10px;" id="addAccount_email" class="form-control no_outline clearVal" type="text" placeholder="Email" autocomplete="off">
<input style="margin-bottom: 10px;" id="addAccount_username" class="form-control no_outline clearVal" type="text" placeholder="Username" autocomplete="off">
<input style="margin-bottom: 10px;" id="addAccount_extra" class="form-control no_outline clearVal" type="text" placeholder="Extra" autocomplete="off">
<input hidden id="addAccount_password">
<div style="margin-top: 10px;">
<button class="btn reply_markup_button fBtn" id="submitAccount" type="submit" style="float:right;width:31%;">Add account</button>
<button data-clipboard-text="" id="copyPassword" type="button" class="btn reply_markup_button copy" style="float:right;width:34%;margin-right:5.5px;">Copy password</button>
<button type="button" class="fBtn btn reply_markup_button" id="hideAccount" style="float:right;width:31%;margin-right:5.5px;">Cancel</button>
</div>
</form>
</div>
<br><br>
</div>
<div id="addSite" style="display:none;padding-top:0px;padding-bottom:0px;" class="im_dialogs_panel">
<div class="im_dialogs_search">
<form>
<input style="margin-bottom: 10px;" id="addSite_url" class="form-control no_outline clearVal" type="text" required placeholder="Site URL" autocomplete="off">
<input style="margin-bottom: 10px;" id="addSite_name" class="form-control no_outline clearVal" type="text" required placeholder="Site Name" autocomplete="off">
<div style="margin-top: 10px;">
<button class="btn reply_markup_button fBtn" id="submitSite" type="submit" style="float: right;width:48%;">Add site</button>
<button class="btn reply_markup_button fBtn" id="hideSite" style="float: right;width:48%;margin-right: 11px;">Cancel</button>
</div>
</form>
</div>
<br><br>
</div>
<ul id="allSites" class="nav nav-pills nav-stacked"></ul>
</div>
</div>
</div>
</div>
<div class="im_history_col_wrap noselect" style="height: 600px;overflow: auto;">
<div class="nsWrap">
<div id="allAccounts" class="im_history_not_selected vertical-aligned" style="text-align: inherit;padding: 10px 10px;">
<br><br><br><br><center><p>Choose an website</p></center>
</div>
</div>
</div>
</div>
</div>
<script src="/lib/dist/clipboard.min.js"></script>
<script>
new Clipboard('.copy');
$(document).ready(function() {
$(".fBtn").click(function(e) {
$.post("lib/system", { ACTION:"checkSession" }, function(checkSession) { if(!checkSession.valid) { window.location.replace("/login"); } else { $("#displaySite").show(); } }, "json");
if(this.id == "showSite") {
$('.clearVal').val('');
$("#addAccount").hide();
$("#addSite").show();
}
if(this.id == "showAccount") {
$('.clearVal').val('');
$("#addAccount").show();
$("#addSite").hide();
randomPassword();
}
if(this.id == "hideSite") {
$("#addSite").hide();
}
if(this.id == "hideAccount") {
$("#addAccount").hide();
}
if(this.id == "submitSite") {
$.post("lib/system", { ACTION:"addSite", name:$("#addSite_name").val(), url:$("#addSite_url").val() }, function() {});
$.post("lib/system", { ACTION:"getSites" }, function(siteInfo){ $('#allSites').html(siteInfo.Html); }, "json");
$("#addSite").hide();
return false;
}
if(this.id == "submitAccount") {
$.post("lib/system", {ACTION:"addAccount", url:$("#addAccount_url").val(), email:$("#addAccount_email").val(), username:$("#addAccount_username").val(), password:$("#addAccount_password").val(), extra:$("#addAccount_extra").val() }, function() {});
$.post("lib/system", { ACTION:"getSites" }, function(siteInfo){ $('#allSites').html(siteInfo.Html); }, "json");
$("#addAccount").hide();
return false;
}
});
});
$(document).ready(function(){
$.post("lib/system", { ACTION:"getSites" }, function(siteInfo) { $('#allSites').html(siteInfo.Html); }, "json");
$.post("lib/system", { ACTION:"checkSession" }, function(checkSession) { if(!checkSession.valid) { window.location.replace("/login"); } else { $("#displaySite").show(); } }, "json");
});
function getAccounts(url) {
$.post("lib/system", { ACTION:"getAccounts", url:url }, function(accountInfo){ $('#allAccounts').html(accountInfo.Html); }, "json");
}
function randomPassword(length = 16, chars = '#aA!', mask = '', result = '') {
if (chars.indexOf('a') > -1) mask += 'abcdefghijklmnopqrstuvwxyz';
if (chars.indexOf('A') > -1) mask += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
if (chars.indexOf('#') > -1) mask += '0123456789';
if (chars.indexOf('!') > -1) mask += '!@#$%&*_+-=:;?,.';
for (var i = length; i > 0; --i) result += mask[Math.round(Math.random() * (mask.length - 1))];
$('#addAccount_password').val(result);
document.getElementById('copyPassword').setAttribute('data-clipboard-text', result);
}
</script>
</body>
</html>