Ohm-Management - Projektarbeit B-ME
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.

ldap_test.js 866B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Terminal call: node server/ldap_test.js - needs VPN or eduroam
  2. const inquirer = require('inquirer'),
  3. ldap = require('./server/ldap_ohm.js');
  4. inquirer.prompt([
  5. {
  6. name: 'username',
  7. type: 'input',
  8. message: 'Enter your VirtuOhm username:',
  9. validate: function( value ) {
  10. if (value.length) {
  11. return true;
  12. } else {
  13. return 'Please enter your username.';
  14. }
  15. }
  16. },
  17. {
  18. name: 'password',
  19. type: 'password',
  20. message: 'Enter your password:',
  21. validate: function(value) {
  22. if (value.length) {
  23. return true;
  24. } else {
  25. return 'Please enter your password.';
  26. }
  27. }
  28. }])
  29. .then(answers => {
  30. ldap.init(null);
  31. ldap.authorize(answers.username,answers.password,function(user) {
  32. console.log(JSON.stringify(user));
  33. process.exit();
  34. });
  35. });