template filter tag in django - filtering {{activate_url}}

Ranu Vijay

I am working with django and react and developing a multi tenant application where each subdomain in django is a different company. Using rest framework. At user registration(company wise user) a confirmation email is send to each user to activate their account.

The email send to users are in the format of

http://company_code.localhost.com:8000/rest-auth/account-confirm-email/key

subdomain wise. After some search i came to know this goes from allauth, send_confirmation_message.text file and in the form of {{activate_url}}

for activating the account from react what i did was changed the default 'send_confirmation_message.txt' file of allauth as :

'http://localhost:3000/verify-email?key={{key}}' -- react

now i automatically filter my key from url on react and post to backend, and activate the account, the manual part still is getting company code from the url which django send in the email.

Again i have read about template filter tag but can not use. So how can i use filter on {{activate_url}} which is http://company_code.localhost.com:8000/rest-auth/account-confirm-email/key to get my company_code and send to react in the form of url.

Getting company_code is important as users are company wise and react should post to a specific company.

Or My approach is wrong and should try something other ?

Thanks

Ranu Vijay

I made it work..

{% blocktrans %} in email_confirmation_message.txt was not allowing me to apply any filer on {{activate_url}} or add any new block.

I removed it and changed the url which user receive in email for activating the account. The new url is : http://front-end.com/verify-email/?id={{key}}&id1={{activate_url|slice:"7:12"}} subdomain is always of 5 character,in my case.

and it takes me to my front end, automatically activate the account on componentDidMount and redirect to login.

ps: blocktrans will not allow to apply any filter, add new block. still don't know what blocktrans is, if anyone can provide detail.

Thanks

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related