mirror of https://github.com/MISP/misp-dashboard
chg: [authentication] add required login to dashboard views
parent
71780003d0
commit
708addaa34
12
server.py
12
server.py
|
@ -136,6 +136,7 @@ def load_user(user_id):
|
||||||
|
|
||||||
|
|
||||||
@app.route('/logout')
|
@app.route('/logout')
|
||||||
|
@login_required
|
||||||
def logout():
|
def logout():
|
||||||
"""
|
"""
|
||||||
Logout the user and redirect to the login form.
|
Logout the user and redirect to the login form.
|
||||||
|
@ -148,7 +149,7 @@ def logout():
|
||||||
@app.route('/login', methods=['GET','POST'])
|
@app.route('/login', methods=['GET','POST'])
|
||||||
def login():
|
def login():
|
||||||
"""
|
"""
|
||||||
Login form.
|
Login form route.
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
if current_user.is_authenticated:
|
if current_user.is_authenticated:
|
||||||
|
@ -168,6 +169,9 @@ def login():
|
||||||
|
|
||||||
|
|
||||||
class LoginForm(Form):
|
class LoginForm(Form):
|
||||||
|
"""
|
||||||
|
WTForm form object. This object defines form fields in the login endpoint.
|
||||||
|
"""
|
||||||
username = StringField('Username', [validators.Length(max=255)])
|
username = StringField('Username', [validators.Length(max=255)])
|
||||||
password = PasswordField('Password', [validators.Length(max=255)])
|
password = PasswordField('Password', [validators.Length(max=255)])
|
||||||
submit = SubmitField('Sign In')
|
submit = SubmitField('Sign In')
|
||||||
|
@ -275,6 +279,7 @@ class EventMessage():
|
||||||
''' MAIN ROUTE '''
|
''' MAIN ROUTE '''
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
|
@login_required
|
||||||
def index():
|
def index():
|
||||||
ratioCorrection = 88
|
ratioCorrection = 88
|
||||||
pannelSize = [
|
pannelSize = [
|
||||||
|
@ -296,11 +301,13 @@ def index():
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route('/favicon.ico')
|
@app.route('/favicon.ico')
|
||||||
|
@login_required
|
||||||
def favicon():
|
def favicon():
|
||||||
return send_from_directory(os.path.join(app.root_path, 'static'),
|
return send_from_directory(os.path.join(app.root_path, 'static'),
|
||||||
'favicon.ico', mimetype='image/vnd.microsoft.icon')
|
'favicon.ico', mimetype='image/vnd.microsoft.icon')
|
||||||
|
|
||||||
@app.route("/geo")
|
@app.route("/geo")
|
||||||
|
@login_required
|
||||||
def geo():
|
def geo():
|
||||||
return render_template('geo.html',
|
return render_template('geo.html',
|
||||||
zoomlevel=cfg.getint('GEO' ,'zoomlevel'),
|
zoomlevel=cfg.getint('GEO' ,'zoomlevel'),
|
||||||
|
@ -308,6 +315,7 @@ def geo():
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route("/contrib")
|
@app.route("/contrib")
|
||||||
|
@login_required
|
||||||
def contrib():
|
def contrib():
|
||||||
categ_list = contributor_helper.categories_in_datatable
|
categ_list = contributor_helper.categories_in_datatable
|
||||||
categ_list_str = [ s[0].upper() + s[1:].replace('_', ' ') for s in categ_list]
|
categ_list_str = [ s[0].upper() + s[1:].replace('_', ' ') for s in categ_list]
|
||||||
|
@ -359,12 +367,14 @@ def contrib():
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route("/users")
|
@app.route("/users")
|
||||||
|
@login_required
|
||||||
def users():
|
def users():
|
||||||
return render_template('users.html',
|
return render_template('users.html',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/trendings")
|
@app.route("/trendings")
|
||||||
|
@login_required
|
||||||
def trendings():
|
def trendings():
|
||||||
maxNum = request.args.get('maxNum')
|
maxNum = request.args.get('maxNum')
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue