Anvil: Web Apps with Nothing but Python Transcripts
Chapter: User management and authentication
Lecture: Logging in

Login or purchase this course to watch this video and the rest of the course contents.
0:00 With most of our user interaction working the last thing to do is log in. And, it turns out that that is super simple as well.
0:08 No surprise, it's anvil.users.something. Log in, options are show signup options so you can log in, oh, don't have an account, create one.
0:18 That's probably good, and that's the default. Now, remember, by default you can say, probably True. allow_remember, True.
0:24 Those are all fine, but the allow_cancel being default of not, I'm going to say we do want to say True here. And, then we'll have just the user
0:33 so we can say self.set_account_state with that user that we got and then, again, we want to refresh the screen so navigation, go home, like so.
0:44 Those three lines, that'll probably do it. Let's give it a shot. All right, so anonymous view, we're going to log in
0:50 hey look, we got a form, that's good. Now, what do we want to do? We could log in with Google. We're going to log in with our username and password.
0:58 We could instead go to the register view we could cancel, or we could just log in. Let's go ahead and just log in.
1:05 Boom, we're logged in, and, just like you expect this updated, went here, and as we move around again, we're still getting this logged-in view.
1:14 Beautiful. So, we can now register, we can log out, and we can log in. Pretty good.


Talk Python's Mastodon Michael Kennedy's Mastodon