Skip to content

Commit 4a31176

Browse files
Warning for using the default secret_key
1 parent ca95f77 commit 4a31176

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

cms/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Contest Management System - http://cms-dev.github.io/
55
# Copyright © 2010-2014 Giovanni Mascellani <mascellani@poisson.phc.unipi.it>
6-
# Copyright © 2010-2012 Stefano Maggiolo <s.maggiolo@gmail.com>
6+
# Copyright © 2010-2015 Stefano Maggiolo <s.maggiolo@gmail.com>
77
# Copyright © 2010-2012 Matteo Boscariol <boscarim@hotmail.com>
88
# Copyright © 2013 Luca Wehrstedt <luca.wehrstedt@gmail.com>
99
# Copyright © 2014 Fabian Gundlach <320pointsguy@gmail.com>
@@ -69,7 +69,8 @@ def __init__(self):
6969
self.sandbox_implementation = 'isolate'
7070

7171
# WebServers.
72-
self.secret_key = "8e045a51e4b102ea803c06f92841a1fb"
72+
self.secret_key_default = "8e045a51e4b102ea803c06f92841a1fb"
73+
self.secret_key = self.secret_key_default
7374
self.tornado_debug = False
7475

7576
# ContestWebServer.

cms/server/static/aws_style.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ ul.normal_list {
161161
text-shadow: none;
162162
}
163163

164+
.secret_notice {
165+
font-size: 0.8em;
166+
line-height: 1.125em;
167+
text-align: center;
168+
margin: 20px auto 20px;
169+
color: red;
170+
}
171+
164172
.cr_notice {
165173
font-size: 0.6em;
166174
line-height: 1.125em;

cms/server/templates/admin/base.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{% import time %}
22
{% import json %}
3-
{% from cms import DEFAULT_LANGUAGES, LANGUAGE_NAMES, LANGUAGES %}
3+
{% from cms import DEFAULT_LANGUAGES, LANGUAGE_NAMES, LANGUAGES, config %}
44
{% from cmscommon.datetime import make_timestamp %}
5+
{% from cmscommon.crypto import get_hex_random_key %}
56
<html>
67
<head>
78
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@@ -65,6 +66,13 @@
6566
<div id="global">
6667
<div id="sidebar">
6768
<h1>Administration</h1>
69+
{% if config.secret_key == config.secret_key_default %}
70+
<div class="secret_notice">
71+
Change secret_key in cms.conf!<br/>
72+
For example,<br/>
73+
{{ get_hex_random_key() }}
74+
</div>
75+
{% end %}
6876
<ul class="menu">
6977
<li class="menu_entry"><a class="menu_link" href="{{ url_root }}/{% if contest is not None %}{{ contest.id }}{% end %}">Overview</a></li>
7078
<li class="menu_entry"><a class="menu_link" href="{{ url_root }}/resourceslist{% if contest is not None %}/{{ contest.id }}{% end %}">Resource usage</a></li>

0 commit comments

Comments
 (0)