Advertisement
Guest User

Untitled

a guest
Aug 1st, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. 'use strict';
  2.  
  3. const username = 'user';
  4. const password = 'secret';
  5.  
  6. module.exports.title = 'Simple Authentication';
  7. module.exports.init = function(app, done) {
  8. // Listen for AUTH command
  9. app.addHook('smtp:auth', (auth, session, next) => {
  10. if (auth.username !== username || auth.password) {
  11. // authentication failed
  12. let err = new Error('Authentication failed');
  13. err.responseCode = 535;
  14. return next(err);
  15. }
  16. // consider the authentication as succeeded as we did not get an error
  17. next();
  18. });
  19.  
  20. done();
  21. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement