Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const username = 'user';
- const password = 'secret';
- module.exports.title = 'Simple Authentication';
- module.exports.init = function(app, done) {
- // Listen for AUTH command
- app.addHook('smtp:auth', (auth, session, next) => {
- if (auth.username !== username || auth.password) {
- // authentication failed
- let err = new Error('Authentication failed');
- err.responseCode = 535;
- return next(err);
- }
- // consider the authentication as succeeded as we did not get an error
- next();
- });
- done();
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement