fix: #14385 (direct login infinite redirect loop)

WP [#14385](https://www.openproject.org/work_packages/14385)
hui, how about matching the string for the `{ }` with a regexp instead of splitting and joining?