cache.type = memory
cache.hourly_term.expire = 3600
-# Mozilla Persona settings
-persona.secret = This is a secret string. Please change me!
-persona.audiences = http://localhost:6543
-persona.siteName = XonStat
-
##### XONSTAT CONFIG SETTINGS #####
# how many "real" players are required before the data
'psycopg2',
'pyramid_beaker',
'pyramid_mako',
- 'pyramid_persona',
'waitress',
]
import sqlahelper
from pyramid_beaker import set_cache_regions_from_settings
-from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.config import Configurator
from pyramid.httpexceptions import HTTPNotFound
from pyramid.renderers import JSONP
# mako for templating
config.include('pyramid_mako')
- # Mozilla Persona as the login verifier. It defines default
- # authentication and authorization policies.
- config.include('pyramid_persona')
-
- # override the authn policy to provide a callback
- secret = settings.get('persona.secret', None)
- authn_policy = AuthTktAuthenticationPolicy(secret, callback=groupfinder, hashalg='sha512')
- config.set_authentication_policy(authn_policy)
-
# for json-encoded responses
config.add_renderer('jsonp', JSONP(param_name='callback'))
${nav.nav('players')}
</%block>
-<%block name="js">
-${parent.js()}
-<script src="https://login.persona.org/include.js" type="text/javascript"></script>
-<script type="text/javascript">${request.persona_js}</script>
-</%block>
-
<%block name="title">
Login
</%block>
<div class="row">
<div class="span12">
Hello ${user}
- ${request.persona_button}
</div>
</div>
<li><a href="${request.route_url('server_index')}" title="Server Index">Servers</a></li>
<li><a href="${request.route_url('map_index')}" title="Map Index">Maps</a></li>
<li><a href="${request.route_url('search')}" title="Search">Search</a></li>
- % if login_logout:
- <li><a href="#" title="Log in with Mozilla Persona">${request.persona_button}</a></li>
- % endif
</ul>
</li>
<li><a href="https://gitlab.com/groups/xonotic" title="Contribute to Xonotic"><i class="fa fa-wrench"></i> Contribute</a></li>
<%namespace name="nav" file="nav.mako" />
<%block name="navigation">
- % if player.email_addr is not None:
- ${nav.nav('players', True)}
- % else:
+ ##### Disable the login button until a replacement is implemented.
${nav.nav('players', False)}
- % endif
</%block>
<%block name="css">
drawAccuracyChart("#accuracyChart", data);
});
</script>
- <script src="https://login.persona.org/include.js" type="text/javascript"></script>
- <script type="text/javascript">${request.persona_js}</script>
</%block>
<%block name="title">
${nav.nav('players')}
</%block>
-<%block name="js">
-${parent.js()}
-<script src="https://login.persona.org/include.js" type="text/javascript"></script>
-<script type="text/javascript">${request.persona_js}</script>
-</%block>
-
<%block name="title">
Merge Players
</%block>
from pyramid.httpexceptions import HTTPFound
from pyramid.security import remember
from pyramid.session import check_csrf_token
-from pyramid_persona.views import verify_login
from xonstat.models import DBSession, Player
def login(request):
# Verify the assertion and get the email of the user
- persona_email = verify_login(request)
+ # Short-circuit this to prevent anyone from logging in right now.
+ persona_email = None
# Check that the email exists in the players table
player_email = DBSession.query(Player).\