I have made customize login and signup from for my web app and want 2FA, signup or login with google and all these user management but there open a default login page with all these option when using anvil.users.login_with_form() but I want all these authentication and user management in my customize forms, how can I do it?
If you search the forum for āuse custom login formā several useful threads are returned, one of which leads you to a tutorial on doing just this.
One of those answers is bound to help.
How can we provide 2FA on customize login and signup forms?
Sorry for inconvenience, I have made customize signup or login page for my web application and I want 2 factor Authentication, signup and login with google in customize forms and these are built-in anvil, but I donāt know how to add these things in customize forms. Can anyone please help me?
class Login(LoginTemplate):
def init(self, **properties):
# Set Form properties and Data Bindings.
self.init_components(**properties)
def button_1_click(self, **event_args):
anvil.users.login_with_email(self.email.text,self.password.text,remember=self.check_box_1.checked)
open_form("Dashboard")
def button_google_click(self, **event_args):
"""This method is called when the button is clicked"""
anvil.users.login_with_google(remember=self.check_box_1.checked)
open_form('Succes')
def link_1_click(self, **event_args):
open_form('signup')
"""This method is called when the link is clicked"""
pass
def link_forget_click(self, **event_args):
"""This method is called when the link is clicked"""
Reset_box=TextBox(placeholder='Enter Your Email')
c=confirm(Reset_box,title='Reset your Password?')
if c==True:
anvil.users.send_password_reset_email(Reset_box.text)
def error_handler(err):
Notification(str(err),style=ādangerā).show()
set_default_error_handling(error_handler)
This is client code for login form and now want to add 2FA in this customize form. How I can I do it, please help me in this?
This is what chat gpt had on the options at your disposal.
So for example if you went with the code option I would send an email with a confirmation code from the server code and then in the ui have an alert popup after the login succeeds with an entry field for the user to put the code in and a button that checks it on the server.
Is there any alternative libraries to implement the 2FA in anvil and are free to use, please tell me about this?
And can we make zip file of codes of all forms?
I found this from a quick Google, but anvil doesnāt have a 2fa library Iām aware of
Yes with media objects:
Hi, actually i want to download my source code including all file like .yaml and python code files in my laptop. As i have to submit the code through email. How can I do it? Thanks in advance.
Thatās covered in the documentation. Under Cloning apps, see the option Clone with Git. (You will need to have a working Git installation on your computer.)
This gives you a local copy of all the source code and configuration files. Subdirectory structure is given here: Anvil Docs | Python Directory Structure
Once you have a local copy, you can zip it up and send it.
The other option, Download as a File, gives you a single file in an Anvil-specific format. Anvil can use it, but very few others would be able to.
Thanks a lot, it would save me from deadline of submission.