rluders / wn-jwtauth-plugin

JWTAuth Plugin for WinterCMS
GNU General Public License v3.0
29 stars 28 forks source link

Overwrite activation url with custom plugin #45

Open abdullah10182 opened 3 years ago

abdullah10182 commented 3 years ago

Hi, I'm trying to overwrite the activation and password reset urls so I can customize these per installation in an .env file for example.

So far I have a custom plugin in which I have this in the Plugin.php file.

use RLuders\JWTAuth\Models\Settings as UserSettings; 

 public function boot(){
   UserSettings::set('activation_url', 'http://localhost:8080/account-activation?code={code}');
 }

This works, the problem is that it clears all the fields in the settings section for the plugin in the backend. The values still exist, they just don't display anymore in their corresponding fields in the settings area.

Any hint what I'm doing wrong?

Thanks, A.

rluders commented 3 years ago

Hello, @abdullah10182 I guess that this PR that will be merged soon can help you to overwrite it using a custom configuration file.

It will be released this weekend, or maybe today. Then I can test it.

abdullah10182 commented 3 years ago

Great, thanks for the awesome work. Will make sure to test it when it comes out.

rluders commented 3 years ago

OK. Just checked, and it seems that the PR doesn't change the Plugin's settings, after all.

So, in fact, what I'll need to do, is to convert your PR into a feature request. 'Cause, checking the code (It was written a long time ago, sorry) I didn't intendet to support this kind of configuration, but it seems interesting.

Let me just check if it would be viable.

UPDATE: The main thing is that it gets the default values from the file, then it replaces the value by the ones available at the database.

rluders commented 3 years ago

I wasn't able to fully test this one, but in my quick tests, it seems that the CMS Settings will always replace the values from the config file.

@abdullah10182 do you have any feedback about this one?

abdullah10182 commented 3 years ago

For now I just manually change the urls whenever I sync the database or move anything to another url. Not a big deal. But would be nice if the url settings where configurable through code in my custom plugin, to make these dynamic per environment.