blob: 1850f5049007989ec5a9cbac49c254915e842ff9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import functools
import os
from flask import (
Blueprint, flash, g, redirect, render_template, request,
session, url_for
)
from werkzeug.security import (
check_password_hash, generate_password_hash
)
from nfsw.db import get_db
bp = Blueprint('auth', __name__)
def login_required(view):
@functools.wraps(view)
def wrapped_view(**kwargs):
if g.user is None:
return redirect(url_for('index'))
return view(**kwargs)
return wrapped_view
|