FIx default of token field for old flow upgrades

to close #1055
This commit is contained in:
Dave Conway-Jones 2024-03-12 12:22:02 +00:00
parent fd027aa95a
commit ea48b6acdd
No known key found for this signature in database
GPG Key ID: 1DDB0E91A28C2643
2 changed files with 14 additions and 6 deletions

View File

@ -66,7 +66,7 @@
</div> </div>
<div class="form-row node-input-token" style="display: none;"> <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> <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"> <input type="text" id="node-input-token" placeholder="oauth2Response.access_token" style="width:70%;">
</div> </div>
<br/> <br/>
<div class="form-row node-input-useTLS"> <div class="form-row node-input-useTLS">
@ -116,6 +116,10 @@
this.authtype = "BASIC"; this.authtype = "BASIC";
$("#node-input-authtype").val('BASIC'); $("#node-input-authtype").val('BASIC');
} }
if (typeof this.token === 'undefined') {
$("#node-input-token").val("oauth2Response.access_token");
this.token = "oauth2Response.access_token";
}
$("#node-input-authtype").change(function() { $("#node-input-authtype").change(function() {
var protocol = $("#node-input-authtype").val(); var protocol = $("#node-input-authtype").val();
if (protocol === "BASIC") { if (protocol === "BASIC") {
@ -220,7 +224,7 @@
</div> </div>
<div class="form-row node-input-token" style="display: none;"> <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> <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"> <input type="text" id="node-input-token" placeholder="oauth2Response.access_token" style="width:70%;">
</div> </div>
<div class="form-row node-input-box"> <div class="form-row node-input-box">
<label for="node-input-box"><i class="fa fa-inbox"></i> <span data-i18n="email.label.folder"></span></label> <label for="node-input-box"><i class="fa fa-inbox"></i> <span data-i18n="email.label.folder"></span></label>
@ -369,6 +373,10 @@
$("#node-input-box").val("INBOX"); $("#node-input-box").val("INBOX");
this.box = "INBOX"; this.box = "INBOX";
} }
if (typeof this.token === 'undefined') {
$("#node-input-token").val("oauth2Response.access_token");
this.token = "oauth2Response.access_token";
}
if (typeof this.criteria === 'undefined') { if (typeof this.criteria === 'undefined') {
$("#node-input-criteria").val("UNSEEN"); $("#node-input-criteria").val("UNSEEN");
this.criteria = "UNSEEN"; this.criteria = "UNSEEN";

View File

@ -1,13 +1,13 @@
{ {
"name": "node-red-node-email", "name": "node-red-node-email",
"version": "2.2.0", "version": "2.2.1",
"description": "Node-RED nodes to send and receive simple emails.", "description": "Node-RED nodes to send and receive simple emails.",
"dependencies": { "dependencies": {
"imap": "^0.8.19", "imap": "^0.8.19",
"node-pop3": "^0.9.0", "node-pop3": "^0.9.0",
"mailparser": "^3.6.4", "mailparser": "^3.6.9",
"nodemailer": "^6.9.9", "nodemailer": "^6.9.12",
"smtp-server": "^3.13.0" "smtp-server": "^3.13.3"
}, },
"bundledDependencies": [ "bundledDependencies": [
"imap", "imap",