SASL Format

Added checkbox to turn off SASL formatting if the user wants to do this themselves
This commit is contained in:
wooferguy 2023-02-09 19:15:00 +13:00
parent 923ad0d361
commit 165e8013a7
3 changed files with 15 additions and 2 deletions

View File

@ -157,6 +157,10 @@
<label for="node-input-password"><i class="fa fa-lock"></i> <span data-i18n="email.label.password"></span></label>
<input type="password" id="node-input-password">
</div>
<div class="form-row node-input-saslformat" style="display: none;">
<label for="node-input-saslformat"><i class="fa fa-code"></i> <span data-i18n="email.label.saslformat"></span></label>
<input type="checkbox" id="node-input-saslformat" style="width: auto;">
</div>
<div class="form-row node-input-token" style="display: none;">
<label for="node-input-token"><i class="fa fa-lock"></i> <span data-i18n="email.label.token"></span></label>
<input type="text" id="node-input-token" placeholder="oauth2Response.access_token">
@ -238,9 +242,11 @@
var protocol = $("#node-input-authtype").val();
if (protocol === "BASIC") {
$(".node-input-password").show();
$(".node-input-saslformat").hide();
$(".node-input-token").hide();
} else {
$(".node-input-password").hide();
$(".node-input-saslformat").show();
$(".node-input-token").show();
}
});
@ -260,6 +266,7 @@
autotls: {value: "never"},
port: {value:"993",required:true},
authtype: {value: "BASIC"},
saslformat: {value: true},
token: {value: "oauth2Response.access_token"},
box: {value:"INBOX"}, // For IMAP, The mailbox to process
disposition: { value: "Read" }, // For IMAP, the disposition of the read email

View File

@ -196,6 +196,7 @@ module.exports = function(RED) {
this.inport = n.port || (globalkeys && globalkeys.port) || "993";
this.box = n.box || "INBOX";
this.useSSL= n.useSSL;
this.saslformat = n.saslformat;
this.autotls= n.autotls;
this.token = n.token || "oAuth2Response.access_token";
this.protocol = n.protocol || "IMAP";
@ -374,8 +375,12 @@ module.exports = function(RED) {
if(node.authtype == "XOAUTH2") {
var value = RED.util.getMessageProperty(msg,node.token);
if (value !== undefined) {
//Make base64 string for access - compatible with outlook365 and gmail
saslxoauth2 = Buffer.from("user="+node.userid+"\x01auth=Bearer "+value+"\x01\x01").toString('base64');
if(node.saslformat) {
//Make base64 string for access - compatible with outlook365 and gmail
saslxoauth2 = Buffer.from("user="+node.userid+"\x01auth=Bearer "+value+"\x01\x01").toString('base64');
} else {
saslxoauth2 = value;
}
}
imap = new Imap({
xoauth2: saslxoauth2,

View File

@ -32,6 +32,7 @@
"unseen": "Unseen",
"autotls": "Start TLS?",
"authtype": "Auth type",
"saslformat": "Format to SASL",
"token": "Token",
"never": "never",
"required": "if required",