getgrav / grav-plugin-login

Grav Login Plugin
http://getgrav.org
MIT License
44 stars 54 forks source link

Activation URL difficulties on multisite #241

Open hughbris opened 4 years ago

hughbris commented 4 years ago

I have a multisite setup using the subdirectory option. The activation URLs generated in the activation emails do not include the site path after the hostname.

I notice in Login::sendNotificationEmail() that it uses $this->grav['base_url_absolute'], which will use a system.custom_base_url if set. So I set that, but that screwed up my stream URLs like url('theme://images/logo.svg') in Twig, so my images and probably other stuff broke.

I don't know where in the stack this problem is best solved. If it's in this plugin, perhaps either of these options is worth implementing:

Or can you think of another solution or workaround?

mahagr commented 4 years ago

Sounds like a bug to me.

hughbris commented 4 years ago

I have thought of another solution. The email bodies are pretty clunky as translation strings (with the newlines, tabs etc) and could be split into more atomic translatable strings. These could be used in Twig templates. This would make the email messages both translatable and more flexible. Strings like the site URL would not need to be coded into PHP any more.

Another benefit is that emails could be sent both as HTML and plain text (using template variants), which will help with spam scores.