|
1234567891011121314151617181920212223242526272829303132333435 |
- // Terminal call: node server/ldap_test.js - needs VPN or eduroam
- const inquirer = require('inquirer'),
- ldap = require('./ldap_ohm.js');
-
- inquirer.prompt([
- {
- name: 'username',
- type: 'input',
- message: 'Enter your VirtuOhm username:',
- validate: function( value ) {
- if (value.length) {
- return true;
- } else {
- return 'Please enter your username.';
- }
- }
- },
- {
- name: 'password',
- type: 'password',
- message: 'Enter your password:',
- validate: function(value) {
- if (value.length) {
- return true;
- } else {
- return 'Please enter your password.';
- }
- }
- }])
- .then(answers => {
- ldap.init(null);
- ldap.authorize(answers.username,answers.password,function(user) {
- console.log(JSON.stringify(user));
- });
- });
|