Advertisement
Guest User

Untitled

a guest
Jun 9th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //startup/startup.js
  2. var isFirstRun = Object()
  3.  
  4. this.isFirstRun = $store.getRaw('/f.dat')
  5.  
  6. if (this.isFirstRun == null) {
  7.  
  8.     setupUser()
  9.  
  10. } else
  11.  
  12. {
  13.  
  14.     readUserFile()
  15.  
  16. }
  17.  
  18. /*
  19.  
  20. Example User File
  21.  
  22. ---
  23.  
  24. userfileheader;07;example;p;05;12345;ender;;08;example1;p;06;123456;;
  25.  
  26. */
  27.  
  28. var doRun = new Object()
  29.  
  30. var userObject = new Object()
  31.  
  32. var userTable = new Object()
  33.  
  34. this.userTable = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]
  35.  
  36. this.userObject = $store.getRaw('/users.js')
  37.  
  38. for (xc = 0; xc++; xc < 27) {
  39.  
  40.  
  41.  
  42. }
  43.  
  44. //createuser
  45.  
  46. function setupUser() {
  47.  
  48.  
  49.  
  50.     if (this.userTable == null) {
  51.  
  52.         var userTable = new Object()
  53.  
  54.         this.userTable = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]
  55.  
  56.     }
  57.  
  58.     if (this.currentFile == null) {
  59.  
  60.         var currentFile = new Object()
  61.  
  62.     } else
  63.  
  64.     {
  65.  
  66.         this.currentFile = ""
  67.  
  68.     }
  69.  
  70.     $alert.info("Remember: Did you load your files.json? If you didn't that's fine, you just won't be able to access the custom themes.")
  71.  
  72.     $prompt('Please type the name of the first user:', 'example', function(ok, text) {
  73.  
  74.         if (ok) {
  75.  
  76.             var textLength = new Object()
  77.  
  78.             this.textLength = text.toString().length
  79.  
  80.             if (this.textLength > 99) {
  81.  
  82.                 $alert.info("Your username can't be over 99 charactors long.")
  83.  
  84.                 setupUser();
  85.  
  86.             }
  87.  
  88.             for (i = 0; i++; i < this.textLength + 1) {
  89.  
  90.                 if (text.toString().charAt(i) == ";") {
  91.  
  92.                     $alert.info("Invalid character! Please only use alphanumeric characters.")
  93.  
  94.                     setupUser();
  95.  
  96.                 } else {
  97.  
  98.                     this.currentFile = "userfileheader;" + this.textLength + ";" + text + ";p;"
  99.  
  100.                 }
  101.  
  102.             }
  103.  
  104.         } else {
  105.  
  106.             $alert.info("You will be prompted on the next reboot to setup.")
  107.  
  108.         }
  109.  
  110.     });
  111.  
  112.     $prompt('Please type the password', '12345', function(ok, text) {
  113.  
  114.         if (ok) {
  115.  
  116.             var textLengthX = new Object()
  117.  
  118.             this.textLengthX = text.toString().length
  119.  
  120.             if (this.textLength > 99) {
  121.  
  122.                 $alert.info("Your username can't be over 99 charactors long.")
  123.  
  124.                 setupUser();
  125.  
  126.             }
  127.  
  128.             for (i = 0; i++; i < this.textLengthX + 1) {
  129.  
  130.                 if (text.toString().charAt(i) == ";") {
  131.  
  132.                     $alert.info("Invalid character! Please only use alphanumeric characters.")
  133.  
  134.                     setupUser();
  135.  
  136.                 } else {
  137.  
  138.                     this.currentFile = this.currentFile + textLengthX.toString() + ";" + text + ";ender"
  139.  
  140.                     $store.set("/f.dat", "success")
  141.  
  142.                     $store.set("/users.js", this.currentFile.toString())
  143.  
  144.                 }
  145.  
  146.             }
  147.  
  148.         }
  149.  
  150.     });
  151.  
  152. }
  153.  
  154. //startup/login.js
  155.  
  156. function login() {
  157.  
  158.     var loginObject = new Object()
  159.  
  160.     this.loginObject = 0
  161.  
  162.     var tempVar = new Object()
  163.  
  164.     var scratchPad = new Object()
  165.  
  166.     var allowPad = new Object()
  167.  
  168.     tempVar = $store.getRaw("/users.js")
  169.  
  170.     scratchPad = tempVar.toString().indexOf("userfileheader;")
  171.  
  172.     if (scratchPad.toString() != "0") {
  173.  
  174.         allowPad = allowPad + 1
  175.  
  176.     } else
  177.  
  178.     {
  179.  
  180.         $alert.error("Currupted userfile! \n\nReseting...");
  181.  
  182.         setupUser();
  183.  
  184.     }
  185.  
  186.     scratchPad = tempVar.toString().charAt(17)
  187.  
  188.     var userLength = new Object()
  189.  
  190.     var userLengthX = new Object()
  191.  
  192.     userLength = scratchPad
  193.  
  194.     scratchPad = tempVar.toString().charAt(18)
  195.  
  196.     userLengthX = scratchPad
  197.  
  198.     var userLengthX2 = new Object()
  199.  
  200.     userLengthX2 = userLength + userLengthX
  201.  
  202.     var userLengthX3 = new Object()
  203.  
  204.     userLengthX3 = parseInt(userLengthX2)
  205.  
  206.     var userLengthX4 = new Object()
  207.  
  208.     userLengthX4 = userLengthX3 + 18
  209.  
  210.     // 19
  211.  
  212.     var username = new Object()
  213.  
  214.     for (i = 18; i++; i < userLengthX4) {
  215.  
  216.         username = username + tempVar.toString().charAt(i)
  217.  
  218.         var currentChar = new Object()
  219.  
  220.         currentChar = i
  221.  
  222.     }
  223.  
  224.     if (tempVar.toString().indexOf(";p;").toString() != currentChar) {
  225.  
  226.         $alert.error("Currupted userfile! \n\nReseting...");
  227.  
  228.         setupUser();
  229.  
  230.     }
  231.  
  232.     scratchPad = tempVar.toString().charAt(26)
  233.  
  234.     var passLength = new Object()
  235.  
  236.     var passLengthX = new Object()
  237.  
  238.     passLength = scratchPad
  239.  
  240.     scratchPad = tempVar.toString().charAt(27)
  241.  
  242.     userLengthX = scratchPad
  243.  
  244.     var passLengthX2 = new Object()
  245.  
  246.     passLengthX2 = passLength + passLengthX
  247.  
  248.     var passLengthX3 = new Object()
  249.  
  250.     passLengthX3 = parseInt(passLengthX2)
  251.  
  252.     var passLengthX4 = new Object()
  253.  
  254.     passLengthX4 = passLengthX3 + 28
  255.  
  256.     var passname = new Object()
  257.  
  258.     for (i = 28; i++; i < userLengthX4) {
  259.  
  260.         passname = passname + tempVar.toString().charAt(i)
  261.  
  262.         var currentCharX = new Object()
  263.  
  264.         currentCharX = i
  265.  
  266.     }
  267.  
  268.     if (tempVar.toString().indexOf(";ender;;").toString() != currentCharX) {
  269.  
  270.         $alert.error("Currupted userfile! \n\nReseting...");
  271.  
  272.         setupUser();
  273.  
  274.     }
  275.  
  276.     var xkk = new Object()
  277.  
  278.     $prompt('Username: ', 'boi', function(ok, text) {
  279.  
  280.         if (ok) {
  281.  
  282.             if (username == text) {
  283.  
  284.                 this.xkk = "verifiedUsername"
  285.  
  286.             }
  287.  
  288.         } else {
  289.  
  290.             tellUser();
  291.  
  292.         }
  293.  
  294.     });
  295.  
  296.     var isSession = new Object()
  297.  
  298.     $prompt('Password: ', 'boi', function(ok, text) {
  299.  
  300.         if (ok) {
  301.  
  302.             if (passname == text && this.xkk == "verifiedUsername") {
  303.  
  304.                 continueLogin(username)
  305.  
  306.             }
  307.  
  308.         } else {
  309.  
  310.             tellUser();
  311.  
  312.         }
  313.  
  314.     });
  315.  
  316.     $prompt('Do you want this to be a admin session? (y/n)', 'n', function(ok, text) {
  317.  
  318.         if (ok) {
  319.  
  320.             if (text.toLowerCase() == "y") {
  321.  
  322.                 this.isSession = "yes"
  323.  
  324.             } else {
  325.  
  326.                 this.isSession = "no"
  327.  
  328.             }
  329.  
  330.         } else {
  331.  
  332.             $alert.error("Since you didn't specify, it will be taken as a No.")
  333.  
  334.         }
  335.  
  336.     });
  337.  
  338. }
  339.  
  340. function continueLogin(username) {
  341.  
  342.     var verfiedUsername = new Object()
  343.  
  344.     var internalUser = new Object()
  345.  
  346.     this.internalUser.user = username
  347.  
  348.     if (this.isSession == "yes") {
  349.  
  350.         this.internalUser.canKA = true
  351.  
  352.     } else
  353.  
  354.     {
  355.  
  356.         this.internalUser.role = "standard"
  357.  
  358.     }
  359.  
  360.     verfiedUsername.username = username
  361.  
  362. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement