You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

168 lines
4.1 KiB

<html>
<head>
<style type="text/css">
body
{
background-image: url('bg.jpg');
}
td
{
font-size: 20px;
color: white;
verical-align: middle;
}
</style>
<script type="text/javascript">
password_prompt = false;
selected_user = null;
time_remaining = 0
function show_prompt(text)
{
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)
{
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 show_error(text)
{
show_message (text);
}
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.login (lightdm.authentication_user, lightdm.default_session);
else
show_message ("Authentication Failed");
reset ();
setTimeout('throbber()', 1000);
}
function timed_login(user)
{
lightdm.login (lightdm.timed_login_user);
setTimeout('throbber()', 1000);
}
function start_authentication(username)
{
lightdm.cancel_timed_login ();
label = document.getElementById('countdown_label');
if (label != null)
label.style.visibility = "hidden";
show_message("");
if (!password_prompt) {
selected_user = username;
lightdm.start_authentication(username);
}
}
function provide_secret()
{
entry = document.getElementById('password_entry');
lightdm.provide_secret(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/gnome/32x32/stock/generic/stock_person.png'
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 + '</td>');
if (user.name == lightdm.timed_login_user && lightdm.timed_login_delay > 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" /></form></td>');
document.write('</tr></table>');
time_remaining = lightdm.timed_login_delay;
if (time_remaining > 0)
countdown();
</script>
</head>
<body>
</body>
</html>