maker-bundle icon indicating copy to clipboard operation
maker-bundle copied to clipboard

[make:registration-form] User ids which are not (scalar) strings

Open wiese opened this issue 3 years ago • 0 comments

The EmailVerifier template for the controller created by make:registration-form uses the user's id when sending out the verification email. This id is used in building a URL (by SymfonyCasts/verify-email-bundle) for the user to click on.

User ids which are not strings (e.g. Ramsey\Uuid) are silently ignored by the symfony router when building the URL due to decisions described in https://github.com/symfony/symfony/issues/26992. This renders the verification link incomplete and the user can never verify (in the "verify_email_anonymously" flow).

According to the reasoning in https://github.com/symfony/symfony/issues/26992 the solution is "casting to string explicitly in user-land". The line may be a bit blurry where user land is in the described case. There are a few options, each with some downsides:

  • maker-bundle does not (directly) know it is passing to symfony router eventually – putting into question casting to string
  • verify-email-bundle does not know anything about the nature of the $extraParams – it would have to cast all of them
  • iltar/http-bundle would offer a way forward without having to touch either bundle – but it is quite an addition to demand to be done manually (given this is a wizard)

How can we best make make:registration-form safe to be used on users with non-scalar string ids?

An example of this problem reported in SymfonyCasts/verify-email-bundle: https://github.com/SymfonyCasts/verify-email-bundle/issues/53

Really recent https://github.com/symfony/symfony/pull/42057 is interesting in this respect.

wiese avatar Oct 27 '21 12:10 wiese