-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
197 lines (168 loc) · 5.58 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
186
187
188
189
190
191
192
193
194
195
196
197
<html>
<head>
<style type="text/css">
body
{
/*background-image: url('bg.jpg');*/
background-size: cover;
font-family: monospace;
background-color: #111111;
}
td
{
font-size: 20px;
color: white;
verical-align: middle;
}
#user_table, #password_table {
position: absolute;
bottom: 10px;
}
#password_table {
right: 10px;
}
#password_entry{
border: none;
background: none;
box-shadow: none;
color: white;
border-bottom: 2px solid white !important;
}
#password_entry::focus{
outline: none;
border: none;
}
:focus {outline:none;}
::-moz-focus-inner {border:0;}
</style>
<script type="text/javascript">
password_prompt = false;
selected_user = null;
time_remaining = 0
function show_prompt(text, type)
{
password_prompt = true;
label = document.getElementById('password_prompt');
label.innerHTML = "";//text;
user_table = document.getElementById('user_table');
for (i in user_table.rows)
{
row = user_table.rows[i];
if (row.id != ('user_' + selected_user) && row.style != null) // FIXME: Don't know why there are rows with styles
row.style.opacity = 0.25;
}
entry = document.getElementById('password_entry');
entry.value = '';
table = document.getElementById('password_table');
table.style.visibility = "visible";
entry.focus();
}
function show_message(text, type)
{
table = document.getElementById('message_table');
label = document.getElementById('message_label');
label.innerHTML = text;
if (text.length > 0)
table.style.visibility = "visible";
else
table.style.visibility = "hidden";
}
function reset()
{
user_table = document.getElementById('user_table');
for (i in user_table.rows)
{
row = user_table.rows[i];
if (row.style != null) // FIXME: Don't know why there are rows with styles
row.style.opacity = 1;
}
table = document.getElementById('password_table');
table.style.visibility = "hidden";
password_prompt = false;
}
loading_text = ''
function throbber()
{
loading_text += '.';
if (loading_text == '....')
loading_text = '.'
label = document.getElementById('countdown_label');
label.innerHTML = loading_text;
setTimeout('throbber()', 1000);
}
function authentication_complete()
{
if (lightdm.is_authenticated)
lightdm.start_session_sync (lightdm.authentication_user, lightdm.default_session);
else
show_message ("authentication failed");
reset ();
setTimeout('throbber()', 1000);
}
function timed_login(user)
{
lightdm.start_session_sync (lightdm.timed_login_user, lightdm.default_session);
setTimeout('throbber()', 1000);
}
function start_authentication(username)
{
lightdm.cancel_autologin ();
label = document.getElementById('countdown_label');
if (label != null)
label.style.visibility = "hidden";
show_message("");
if (!password_prompt) {
selected_user = username;
lightdm.authenticate(username);
}
}
function provide_secret()
{
entry = document.getElementById('password_entry');
lightdm.respond(entry.value);
}
function countdown()
{
label = document.getElementById('countdown_label');
label.innerHTML = ' in ' + time_remaining + ' seconds'
time_remaining--;
if (time_remaining >= 0)
setTimeout('countdown()', 1000);
}
document.write('<table id="user_table" style="margin: auto;">');
for (i in lightdm.users)
{
user = lightdm.users[i];
if (user.image.length > 0)
image = user.image
else
image = 'file:///usr/share/icons/Paper/scalable/status/user-available-symbolic.svg'
document.write('<tr id="user_' + user.name +'"onclick="start_authentication(\'' + user.name + '\')" style="cursor: pointer;">');
document.write('<td><img width="48px" height="48px" src="' + image + '" /></td>');
document.write('<td>' + user.display_name.toLowerCase() + '</td>');
if (user.name == lightdm.autologin_user && lightdm.autologin_timeout > 0)
document.write('<td id="countdown_label"></td>');
document.write('</tr>');
}
document.write('</table>');
document.write('<table id="message_table" style="margin: auto; visibility: hidden;"><td id="message_label"></td></table>');
document.write('<table id="password_table" style="margin: auto; visibility: hidden; color: red;"><tr>');
document.write('<td id="password_prompt"></td>');
document.write('<td><form action="javascript: provide_secret()"><input id="password_entry" type="password" placeholder="password" /></form></td>');
document.write('</tr></table>');
time_remaining = lightdm.autologin_timeout;
if (time_remaining > 0)
countdown();
function pad(a,b){return(1e15+a+"").slice(-b)}
function getImg(){
selectBG = Math.floor(Math.random() * 46);
document.getElementsByTagName('body')[0].style.backgroundImage = 'url(wallpapers/' + pad(selectBG, 2) + '.png)';
// start_authentication('YOURUSERNAME'); // lazy hard coding because I'm lazy. if you want the password
// box to autoshow for a specific user like me, uncomment this
// and put in the username, or be less lazy and don't hardcode
}
</script>
</head>
<body onload="getImg()">
</body>
</html>