Commit 35447bd0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix POP3 setup wizard defaults to unencrypted connections.

Now I check encrypt support when I create resource.
So if resource support starttls it will set option for it.

BUG: 423426
FIXED-IN: 5.19.0
parent 584644ba
Pipeline #96632 failed with stage
in 10 minutes and 1 second
/* /*
SPDX-FileCopyrightText: 2009 Montel Laurent <montel@kde.org> SPDX-FileCopyrightText: 2009-2021 Montel Laurent <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later SPDX-License-Identifier: LGPL-2.0-or-later
*/ */
...@@ -30,21 +30,70 @@ function validateInput() ...@@ -30,21 +30,70 @@ function validateInput()
} }
} }
var stage = 1;
function setup() function setup()
{ {
var pop3Res = SetupManager.createResource( "akonadi_pop3_resource" ); if ( stage == 1 ) {
pop3Res.setOption( "Host", page.widget().incommingAddress.text.trim() ); ServerTest.test( page.widget().incommingAddress.text.trim(), "pop" );
pop3Res.setOption( "Login", page.widget().userName.text.trim() ); } else {
pop3Res.setOption( "Password", SetupManager.password() ); ServerTest.test( page.widget().outgoingAddress.text.trim(), "smtp" );
}
}
function testResultFail()
{
testOk( -1 );
}
var smtp = SetupManager.createTransport( "smtp" ); function testOk( arg )
smtp.setName( SetupManager.name() ); {
smtp.setHost( page.widget().outgoingAddress.text.trim() ); if (stage == 1) {
smtp.setEncryption( "SSL" ); SetupManager.openWallet();
var pop3Res = SetupManager.createResource( "akonadi_pop3_resource" );
var server = page.widget().incommingAddress.text.trim();
pop3Res.setOption( "Host", server );
pop3Res.setOption( "Login", page.widget().userName.text.trim() );
pop3Res.setOption( "Password", SetupManager.password() );
if ( arg == "ssl" ) {
pop3Res.setOption( "Port", 995 );
pop3Res.setOption( "UseTLS", true );
} else if ( arg == "tls" ) { // tls is really STARTTLS
pop3Res.setOption( "Port", 110 );
pop3Res.setOption( "UseTLS", true );
} else if ( arg == "none" ) {
pop3Res.setOption( "Port", 110 );
} else {
pop3Res.setOption( "Port", 110 );
}
stage = 2;
setup();
} else {
var smtp = SetupManager.createTransport( "smtp" );
smtp.setName( page.widget().outgoingAddress.text.trim() );
smtp.setHost( page.widget().outgoingAddress.text.trim() );
if ( arg == "ssl" ) {
smtp.setEncryption( "SSL" );
} else if ( arg == "tls" ) {
smtp.setEncryption( "TLS" );
} else {
smtp.setEncryption( "None" );
}
smtp.setUsername( page.widget().userName.text );
smtp.setPassword( SetupManager.password() );
SetupManager.execute();
}
}
SetupManager.execute(); try {
ServerTest.testFail.connect( testResultFail );
ServerTest.testResult.connect( testOk );
page.widget().incommingAddress.textChanged.connect( validateInput );
page.pageLeftNext.connect( setup );
} catch ( e ) {
print( e );
} }
page.widget().incommingAddress.textChanged.connect( serverChanged );
page.pageLeftNext.connect( setup );
validateInput(); validateInput();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment