Skip to content

Conversation

@tomneedham
Copy link
Contributor

Description

Related Issue

#28425

Motivation and Context

Otherwise invalid emails can be set by accident

How Has This Been Tested?

OCC commands with invalid and valid email addreses

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@tomneedham tomneedham added this to the development milestone Jul 18, 2017
@tomneedham tomneedham requested a review from phil-davis July 18, 2017 09:33
Copy link
Contributor

@phil-davis phil-davis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works
the question is now, should it work like this (create the user, but just not set any email address), or
not create the user at all

@phil-davis
Copy link
Contributor

@PVince81 @DeepDiver1975 or whoever, what do you think should be the behavior when the email address is not valid?
Add the user anyway, without an email address, or give an error and do not add the user at all?

@PVince81
Copy link
Contributor

I'd say don't add the user at all as the whole user entity failed validation by having a wrong email address

// Validate first
if(!$this->mailer->validateMailAddress($input->getOption('email'))) {
// Invalid! Error
$output->writeln('<error>Invalid email address supplied</error>');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please throw / return error code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation will have to happen before:

$this->userManager->createUser()

and throw an error there, before the user is created.
Then the code to create the email address happen around here, after the user is created.

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@PVince81 PVince81 merged commit ae2451c into master Aug 1, 2017
@PVince81 PVince81 deleted the validate-email branch August 1, 2017 08:52
@PVince81
Copy link
Contributor

PVince81 commented Aug 1, 2017

@tomneedham please backport to stable10

@lock
Copy link

lock bot commented Aug 3, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants