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
0:02 the last thing to do is log in.
0:05 And, it turns out that that is super simple as well.
0:07 No surprise, it's anvil.users.something.
0:11 Log in, options are show signup options
0:14 so you can log in, oh, don't have an account, create one.
0:17 That's probably good, and that's the default.
0:19 Now, remember, by default you can say, probably True.
0:22 allow_remember, True.
0:23 Those are all fine, but the allow_cancel
0:25 being default of not, I'm going to say
0:29 we do want to say True here.
0:31 And, then we'll have just the user
0:32 so we can say self.set_account_state
0:35 with that user that we got
0:36 and then, again, we want to refresh the screen
0:39 so navigation, go home, like so.
0:43 Those three lines, that'll probably do it.
0:45 Let's give it a shot.
0:47 All right, so anonymous view, we're going to log in
0:49 hey look, we got a form, that's good.
0:52 Now, what do we want to do?
0:53 We could log in with Google.
0:55 We're going to log in with our username and password.
0:57 We could instead go to the register view
1:00 we could cancel, or we could just log in.
1:02 Let's go ahead and just log in.
1:04 Boom, we're logged in, and, just like you expect
1:07 this updated, went here, and as we move around
1:10 again, we're still getting this logged-in view.
1:13 Beautiful. So, we can now register, we can log out, and we can log in.
1:19 Pretty good.