Hello again Friends:
Pretty soon the forum will charge me rent.
Continuing my work with Login scenarios / paths today, I’ve run into something (which I thought I once understood). Using the below snippet, a float-down form to accept an eMail address appears as expected, and the code executes its if/clause when either an invalid eMail address is supplied or the Cancel option is clicked. No problem.
However, when I enter a valid eMail address and proceed to click its Magic Link, the if/clause isn’t executed (good), but the code never reaches the print() statement either. It’s like anvil.users.login_with_form()
fork/exec’ed elsewhere (to use UNIX terms).
from ._anvil_designer import MainTemplate
from anvil import *
import anvil.users
class Main(MainTemplate): # A Form.
def __init__(self, **properties):
self.init_components(**properties)
# Event handler tied to click of the Form's Login button.
def btn_login_click(self, **event_args):
if not anvil.users.login_with_form(allow_cancel=True,allow_remembered=False):
alert(f'Login successfully cancelled.', dismissible=False, title='INFO')
anvil.users.logout() # They never logged, but shouldn't hurt. =:)
return
print('Got Here!') # But it never gets here.
I’m sure it’s a behavior I’ve not yet fully understood.
Thank you!
PS: We can ignore the if section and consider just the following under both scenarios mentioned:
anvil.users.login_with_form(allow_cancel=True,allow_remembered=False):
print('Got Here!')
# Never gets here after valid Magic-Link click; or
# even after successful 3rd-party login via Google.