I've noticed when testing the SMTP transport that it removes your password if you change any of the other settings.

When you return to the Transport tab after configuring it with a password, the password field has this message below it:

A password required by the SMTP server. The currently set password is hidden for security reasons.

However, if you make a change then click Save, the test fails. When you go back to the Transport tab, this message has changed:

A password required by the SMTP server (leave blank if not required)

It appears that the password is removed when you click Save (or, more correctly, set to the value of the field, which was left empty).

The only workaround is to supply the password every time you make a change.

Suggested fix options:

  1. Change functionality so the existing password is not removed when changing and saving Transport settings.
  2. Change the message to explain that you need to supply the SMTP password again when saving any changes.

My preference would be #1.

CommentFileSizeAuthor
#5 2922795-5.patch2.22 KBwebflo
#3 2922795-3.patch2.08 KBwebflo

Comments

millionleaves created an issue. See original summary.

millionleaves’s picture

Here's a fix. In this file:

swiftmailer/src/form/SettingsForm.php

Replace this line (243):

$config->set('smtp_password', $form_state->getValue(['transport', 'configuration', SWIFTMAILER_TRANSPORT_SMTP, 'password']));

with the following code:

		  $current_password = $config->get('smtp_password');
		  if (empty($current_password) || (!empty($form_state->getValue(['transport', 'configuration', SWIFTMAILER_TRANSPORT_SMTP, 'password'])))) {
		  	$config->set('smtp_password', $form_state->getValue(['transport', 'configuration', SWIFTMAILER_TRANSPORT_SMTP, 'password']));
		  }

(edit - modified replace the current password if a new one has been supplied).

webflo’s picture

Version: 8.x-1.0-beta1 » 8.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new2.08 KB

Status: Needs review » Needs work

The last submitted patch, 3: 2922795-3.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

webflo’s picture

Status: Needs work » Needs review
StatusFileSize
new2.22 KB
millionleaves’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the patch.

I applied it to the latest dev version and configured it to connect to a SMTP server.

After saving the initial changes, I then made further changes to the configuration. The password field changed to reflect the fact that there was a saved password and added the option to delete the saved password. I left the field untouched when saving my other configuration, and the password remained in place.

  • webflo committed db2a5cd on 8.x-1.x
    Issue #2922795 by webflo, millionleaves: SMTP transport forgets password...
webflo’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the review.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.