Guest User

js

a guest
Nov 2nd, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Constants
  2. var AUTHENTICATION_BEGIN_MESSAGE = "Logging in...";
  3. var AUTHENTICATION_SUCCUESS_MESSAGE = ""; // Should never actually show.
  4. var AUTHENTICATION_FAILURE_MESSAGE = "Incorrect password";
  5. var PLACEHOLDER_COLOURS = [
  6.     '#FF6138',
  7.     '#FFFF9D',
  8.     '#BEEB9F',
  9.     '#79BD8F',
  10.     '#00A388',
  11. ];
  12.  
  13. // Globals
  14. var authenticating = false;
  15. var activeUser = null;
  16. var activeSession = null;
  17. var availableUsers = [];
  18. var availableSessions = [];
  19.  
  20. /**
  21.  * Gets the list of available users from lightdm and fills out the #user-list
  22.  * element with them. Records the elements created for each user in the
  23.  * availableUsers array.
  24.  */
  25. function generateUserList() {
  26.     var userList = $('#user-list');
  27.     for (var i in lightdm.users) {
  28.         var user = lightdm.users[i];
  29.         var userListEntry = $('<div />', {
  30.             class: 'user'
  31.         });
  32.  
  33.  
  34.         userListEntry.data('user', user);
  35.  
  36.         // Add an image to represent the user. If no .face image is available,
  37.         // use a colour from the palette.
  38.         var userImage = $('<div />', {
  39.             class: 'bubble'
  40.         });
  41.         // Set the background colour regardless since the user.image path might
  42.         // be invalid.
  43.         userImage.css({
  44.             backgroundColor: PLACEHOLDER_COLOURS[i % PLACEHOLDER_COLOURS.length]
  45.         });
  46.         if (user.image.length > 0) {    //LINE 46 ERR
  47.             userImage.css({
  48.                 'background-image': 'url(' + user.image + ')'
  49.             });
  50.         }
  51.         userImage.appendTo(userListEntry);
  52.  
  53.         // Add the user's full name if it's specified, otherwise fallback to
  54.         // using just their username.
  55.         var username = $('<div />', {
  56.             class: 'user-name'
  57.         });
  58.         if (user.display_name.length > 0) {
  59.             username.text(user.display_name);
  60.         } else {
  61.             username.text(user.name);
  62.         }
  63.         username.appendTo(userListEntry);
  64.  
  65.         availableUsers.push(userListEntry);
  66.         userListEntry.appendTo(userList);
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment