Anvil Community Forum

URL not redirecting

Hello Team,

What I’m trying to do:

I have created a custom sign in /Register form in anvil and Iam sending mails using python SMTP library with the link generated using anvil.server.get_app_origin()

I validate and perform certain updates on my MySQL DB once the user clicks the below link in his mail box

I grab the parameters in the above URL using anvil.get_url_hash() and perform validation in the form_show event of my HomePage.
But this validation keeps firing every time I return to home page even after I move to other pages after login and the url does not change.
and still shows the link which I clicked from my mail

Note: I have not hosted this URL in public domain yet and still under development and this is the URL in my dev environment

How to change the URL once I log in or how to stop this validation from firing again every time go to my home page…thanks in advance

Code Sample:

# code snippet

Clone link:
share a copy of your app

The hash routing dependency takes care of the Javascript needed to change the URL showing in the address bar (and much more). It’s part of the Anvil Extras library: Anvil Extras v1.4.0

Although i am able to solve this validation from firing every time i goto my HomePage using another condition , I just want to know how not to display the URL which I have sent to the mail ID as a link even after moving to different page

It may be useful to use a start up module for the logic you’re describing

Anvil Docs | Client-Side Python

And there’s a method anvil.set_url_hash() which you could use to override the initial hash value you receive.

appreciate it Stu , let me try and come back

Thx Jay…let me try it out