fusio icon indicating copy to clipboard operation
fusio copied to clipboard

html in activation or reset password mail body

Open SavvyEngineer opened this issue 3 years ago • 6 comments

first of all thanks for the amazing project I wanted to use HTML mail template in mail_register_body but when I add the HTML code I'm getting this

The server encountered an internal error and was unable to complete your request.

and I didn't find anything in logs

SavvyEngineer avatar Mar 29 '22 07:03 SavvyEngineer

Hi, thanks for the feedback, so regarding your question in general it should be possible to simply enter html at the config, since we send the body as HTML s. https://github.com/apioo/fusio-impl/blob/master/src/Mail/Sender/SMTP.php#L53

Could you set the FUSIO_ENV="dev" setting at the .env file, then you should also get a better error message.

chriskapp avatar Mar 30 '22 21:03 chriskapp

@chriskapp hi i will try this thanks for your help and i was wondering if you could add resending register mail endpoint that gets user email as an argument in Consumer , because the email sends only on the initial registeration event and i think it would be nice if there was any endpoint to check if is consumer account is enabled or disabled because if the account is not activated yet the result of consumer/login is invalid user/pass and its confusing

SavvyEngineer avatar Mar 30 '22 22:03 SavvyEngineer

after changing FUSIO_ENV="dev" this came in logs i belive there is an error with using html as json object

"message": "Syntax error, malformed JSON in /var/www/mydomain/vendor/psx/json/src/Parser.php on line 74",

SavvyEngineer avatar Mar 31 '22 17:03 SavvyEngineer

Ok, so regarding the error message, this indicates that the JSON your are sending to your endpoint is not valid JSON, you should also set a correct Content-Type to application/json. Regarding the endpoint in general such an endpoint would be possible but it could be also easily misused. Iam not sure how other services manage this case, but in case you did not receive the first activation email there is probably no easy way to fix your account. As admin you can solve all this at the backend panel but for the user who has registered there is no easy way.

chriskapp avatar Mar 31 '22 19:03 chriskapp

@chriskapp ok so i figured out a hacky way to resend activation mail so for example our user somehow doesn't receive activation mail i will use main sql connect to fusio_users and check for status if the status is not 1 then i will get the initial generated token from fusio_users table and send it to that user email with smtp connection so that the user can verify it's account after all and for the part that i mentioned there is a same response for both wrong pass and disabled account iam using sql connection to fusio_users table and if there's no entry found we can assume that the user name is wrong

SavvyEngineer avatar Mar 31 '22 19:03 SavvyEngineer

@SavvyEngineer ok so your workaround should work but maybe we should also add this as a native feature to Fusio. I will keep this issue open so that we can address this in the future. Maybe we only need to add a new button at then backend where the admin can resend the token to the user. If others are also interested in such a feature please let me know.

chriskapp avatar May 22 '22 18:05 chriskapp