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.
 
 
 
 
 
 

50 regels
1.3 KiB

  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. </head>
  6. <body>
  7. <script src="../dist/lesspass.min.js"></script>
  8. <script>
  9. function displayInBody(txt) {
  10. document.body.innerHTML = document.body.innerHTML + txt + '<br>';
  11. }
  12. function displayErrorInBody(txt) {
  13. document.body.innerHTML = document.body.innerHTML + '<span style="color:red;">' + txt + '</span><br>';
  14. }
  15. function createFingerprint() {
  16. LessPass.createFingerprint('password').then(fingerprint => {
  17. displayInBody("createFingerprint :");
  18. displayInBody("e56a207acd1e6714735487c199c6f095844b7cc8e5971d86c003a7b6f36ef51e");
  19. displayInBody(fingerprint + " (generated)")
  20. });
  21. }
  22. function generatePassword() {
  23. const profile = {
  24. site: 'example.org',
  25. login: 'contact@example.org'
  26. }
  27. const masterPassword = 'password';
  28. LessPass.generatePassword(profile, masterPassword).then(function(generatedPassword) {
  29. displayInBody("<br>generatePassword :");
  30. displayInBody("WHLpUL)e00[iHR+w");
  31. displayInBody(generatedPassword + " (generated)")
  32. });
  33. }
  34. LessPass.isSupported().then(function(isSupported) {
  35. if (isSupported) {
  36. createFingerprint();
  37. generatePassword();
  38. }
  39. else {
  40. displayErrorInBody("LessPass is not supported on your browser!");
  41. }
  42. });
  43. </script>
  44. </body>
  45. </html>