calebthewood / flask-warbler

0 stars 0 forks source link

DRY Up the Authorization #4

Open calebthewood opened 2 years ago

calebthewood commented 2 years ago

This will be more advanced. In many routes, there are a few lines that check for is-a-user-logged-in. You could solve this by writing your own “decorator”, like “@app.route”, but that checks if the g.user object is not null and, if not, flashes and redirects.

You’ll need to do some searching and reading about Python decorators to do this.