Merge remote-tracking branch 'refs/remotes/R4stl1n/master'

This commit is contained in:
Brett Costabile 2015-11-18 00:48:28 -05:00
commit 6e9f08520a
19 changed files with 151 additions and 94 deletions

View File

@ -161,7 +161,7 @@ STATIC_URL = '/static/'
# Set to FALSE for alliance # Set to FALSE for alliance
# Set to TRUE for corp # Set to TRUE for corp
########################### ###########################
IS_CORP = 'False' == os.environ.get('AA_IS_CORP', 'True') IS_CORP = 'True' == os.environ.get('AA_IS_CORP', 'True')
################# #################

View File

@ -211,6 +211,8 @@ def run_api_refresh():
if authserviceinfo.main_char_id: if authserviceinfo.main_char_id:
if authserviceinfo.main_char_id != "": if authserviceinfo.main_char_id != "":
#preserve old corp ID for corp change test on members #preserve old corp ID for corp change test on members
oldcorp_id = 0
if EveManager.get_character_by_id(authserviceinfo.main_char_id):
oldcorp_id = EveCharacter.objects.get(character_id=authserviceinfo.main_char_id).corporation_id oldcorp_id = EveCharacter.objects.get(character_id=authserviceinfo.main_char_id).corporation_id
for api_key_pair in api_key_pairs: for api_key_pair in api_key_pairs:
print 'Running on ' + api_key_pair.api_id + ':' + api_key_pair.api_key print 'Running on ' + api_key_pair.api_id + ':' + api_key_pair.api_key
@ -227,6 +229,7 @@ def run_api_refresh():
if valid_key: if valid_key:
# Check our main character # Check our main character
character = EveManager.get_character_by_id(authserviceinfo.main_char_id) character = EveManager.get_character_by_id(authserviceinfo.main_char_id)
if character is not None and EveManager.check_if_corporation_exists_by_id(character.corporation_id):
corp = EveManager.get_corporation_info_by_id(character.corporation_id) corp = EveManager.get_corporation_info_by_id(character.corporation_id)
main_corp_id = EveManager.get_charater_corporation_id_by_id(authserviceinfo.main_char_id) main_corp_id = EveManager.get_charater_corporation_id_by_id(authserviceinfo.main_char_id)
main_alliance_id = EveManager.get_charater_alliance_id_by_id(authserviceinfo.main_char_id) main_alliance_id = EveManager.get_charater_alliance_id_by_id(authserviceinfo.main_char_id)
@ -279,7 +282,13 @@ def run_api_refresh():
disable_blue_member(user) disable_blue_member(user)
else: else:
deactivate_services(user) deactivate_services(user)
else:
if check_if_user_has_permission(user, "member"):
disable_alliance_member(user, authserviceinfo.main_char_id)
elif check_if_user_has_permission(user, "blue_member"):
disable_blue_member(user)
else:
deactivate_services(user)
else: else:
# disable accounts with invalid keys # disable accounts with invalid keys
if check_if_user_has_permission(user, "member"): if check_if_user_has_permission(user, "member"):
@ -419,7 +428,7 @@ def run_corp_update():
# Remove irrelevent corp and alliance models # Remove irrelevent corp and alliance models
# Check the corps # Check the corps
for all_corp_info in EveManager.get_all_corporation_info(): for all_corp_info in EveManager.get_all_corporation_info():
if (settings.IS_CORP and all_corp_info.corporation_id != settings.CORP_ID) or (not settings.IS_CORP and all_corp_info.alliance_id != settings.ALLIANCE_ID): if (settings.IS_CORP and all_corp_info.corporation_id != settings.CORP_ID) or (not settings.IS_CORP and all_corp_info.alliance.alliance_id != settings.ALLIANCE_ID):
if not all_corp_info.is_blue: if not all_corp_info.is_blue:
all_corp_info.delete() all_corp_info.delete()
@ -428,7 +437,3 @@ def run_corp_update():
if (not settings.IS_CORP and all_alliance_info.alliance_id != settings.ALLIANCE_ID): if (not settings.IS_CORP and all_alliance_info.alliance_id != settings.ALLIANCE_ID):
if all_alliance_info.is_blue is not True: if all_alliance_info.is_blue is not True:
all_alliance_info.delete() all_alliance_info.delete()
if all_alliance_info.is_blue is not True:
all_alliance_info.delete()

View File

@ -2,7 +2,9 @@ from django.contrib import admin
from models import GroupDescription from models import GroupDescription
from models import GroupRequest from models import GroupRequest
from models import HiddenGroup
admin.site.register(GroupDescription) admin.site.register(GroupDescription)
admin.site.register(GroupRequest) admin.site.register(GroupRequest)
admin.site.register(HiddenGroup)

View File

@ -22,3 +22,9 @@ class GroupRequest(models.Model):
def __str__(self): def __str__(self):
return self.user.username + ":" + self.group.name return self.user.username + ":" + self.group.name
class HiddenGroup(models.Model):
group = models.ForeignKey(Group, unique=True)
def __str__(self):
return self.group.name + " - Hidden"

View File

@ -8,6 +8,7 @@ from django.contrib.auth.models import Group
from models import GroupDescription from models import GroupDescription
from models import GroupRequest from models import GroupRequest
from models import HiddenGroup
from authentication.managers import AuthServicesInfoManager from authentication.managers import AuthServicesInfoManager
from eveonline.managers import EveManager from eveonline.managers import EveManager
@ -100,6 +101,8 @@ def groups_view(request):
pass pass
elif settings.DEFAULT_BLUE_GROUP in group.name: elif settings.DEFAULT_BLUE_GROUP in group.name:
pass pass
elif HiddenGroup.objects.filter(group=group).exists():
pass
else: else:
# Get the descriptionn # Get the descriptionn
groupDesc = GroupDescription.objects.filter(group=group) groupDesc = GroupDescription.objects.filter(group=group)

View File

@ -3,7 +3,7 @@ from django.contrib.auth.models import User
class RegistrationForm(forms.Form): class RegistrationForm(forms.Form):
username = forms.CharField(max_length=32, required=True) username = forms.CharField(max_length=30, required=True)
password = forms.CharField(widget=forms.PasswordInput(), required=True) password = forms.CharField(widget=forms.PasswordInput(), required=True)
password_again = forms.CharField(widget=forms.PasswordInput(), required=True, label="Password Again") password_again = forms.CharField(widget=forms.PasswordInput(), required=True, label="Password Again")
email = forms.CharField(max_length=254, required=True) email = forms.CharField(max_length=254, required=True)

View File

@ -32,9 +32,18 @@ class Phpbb3Manager:
SQL_GET_USER_GROUPS = r"SELECT phpbb_groups.group_name FROM phpbb_groups , phpbb_user_group WHERE " \ SQL_GET_USER_GROUPS = r"SELECT phpbb_groups.group_name FROM phpbb_groups , phpbb_user_group WHERE " \
r"phpbb_user_group.group_id = phpbb_groups.group_id AND user_id=%s" r"phpbb_user_group.group_id = phpbb_groups.group_id AND user_id=%s"
SQL_ADD_USER_AVATAR = r"UPDATE phpbb_users SET user_avatar_type=2, user_avatar_width=64, user_avatar_height=64, user_avatar=%s WHERE user_id = %s"
def __init__(self): def __init__(self):
pass pass
@staticmethod
def __add_avatar(username, characterid):
avatar_url = "http://image.eveonline.com/Character/" + characterid + "_64.jpg"
cursor = connections['phpbb3'].cursor()
userid = Phpbb3Manager.__get_user_id(username)
cursor.execute(Phpbb3Manager.SQL_ADD_USER_AVATAR, [avatar_url, userid])
@staticmethod @staticmethod
def __generate_random_pass(): def __generate_random_pass():
return os.urandom(8).encode('hex') return os.urandom(8).encode('hex')
@ -113,7 +122,7 @@ class Phpbb3Manager:
pass pass
@staticmethod @staticmethod
def add_user(username, email, groups): def add_user(username, email, groups, characterid):
cursor = connections['phpbb3'].cursor() cursor = connections['phpbb3'].cursor()
username_clean = Phpbb3Manager.__santatize_username(username) username_clean = Phpbb3Manager.__santatize_username(username)
@ -130,6 +139,7 @@ class Phpbb3Manager:
email, 2, Phpbb3Manager.__get_current_utc_date(), email, 2, Phpbb3Manager.__get_current_utc_date(),
"", ""]) "", ""])
Phpbb3Manager.update_groups(username_clean, groups) Phpbb3Manager.update_groups(username_clean, groups)
Phpbb3Manager.__add_avatar(username_clean, characterid)
except: except:
pass pass
@ -203,12 +213,13 @@ class Phpbb3Manager:
return False return False
@staticmethod @staticmethod
def update_user_password(username): def update_user_password(username, characterid):
cursor = connections['phpbb3'].cursor() cursor = connections['phpbb3'].cursor()
password = Phpbb3Manager.__generate_random_pass() password = Phpbb3Manager.__generate_random_pass()
if Phpbb3Manager.check_user(username): if Phpbb3Manager.check_user(username):
pwhash = Phpbb3Manager.__gen_hash(password) pwhash = Phpbb3Manager.__gen_hash(password)
cursor.execute(Phpbb3Manager.SQL_UPDATE_USER_PASSWORD, [pwhash, username]) cursor.execute(Phpbb3Manager.SQL_UPDATE_USER_PASSWORD, [pwhash, username])
Phpbb3Manager.__add_avatar(username, characterid)
return password return password
return "" return ""

View File

@ -115,6 +115,7 @@ class Teamspeak3Manager:
@staticmethod @staticmethod
def _sync_ts_group_db(): def _sync_ts_group_db():
try:
remote_groups = Teamspeak3Manager._group_list() remote_groups = Teamspeak3Manager._group_list()
local_groups = TSgroup.objects.all() local_groups = TSgroup.objects.all()
for key in remote_groups: for key in remote_groups:
@ -128,6 +129,8 @@ class Teamspeak3Manager:
q = TSgroup.objects.filter(ts_group_id=g.ts_group_id) q = TSgroup.objects.filter(ts_group_id=g.ts_group_id)
if not q: if not q:
g.save() g.save()
except:
pass
@staticmethod @staticmethod
def add_user(username, corp_ticker): def add_user(username, corp_ticker):
@ -139,9 +142,9 @@ class Teamspeak3Manager:
server_groups = Teamspeak3Manager._group_list() server_groups = Teamspeak3Manager._group_list()
if not settings.DEFAULT_AUTH_GROUP in server_groups: if not settings.DEFAULT_AUTH_GROUP in server_groups:
Teamspeak3Manager._create_group(settings.DEFAULT_ALLIANCE_GROUP) Teamspeak3Manager._create_group(settings.DEFAULT_AUTH_GROUP)
alliance_group_id = Teamspeak3Manager._group_id_by_name(settings.DEFAULT_ALLIANCE_GROUP) alliance_group_id = Teamspeak3Manager._group_id_by_name(settings.DEFAULT_AUTH_GROUP)
ret = server.send_command('tokenadd', {'tokentype': 0, 'tokenid1': alliance_group_id, 'tokenid2': 0, ret = server.send_command('tokenadd', {'tokentype': 0, 'tokenid1': alliance_group_id, 'tokenid2': 0,
'tokendescription': username_clean, 'tokendescription': username_clean,

View File

@ -139,7 +139,8 @@ class TS3Proto():
v = [v[0], '='.join(v[1:])] v = [v[0], '='.join(v[1:])]
key, value = v key, value = v
keys[key] = self._unescape_str(value) keys[key] = self._unescape_str(value)
elif v[0][0] and v[0][0] == '-': elif (not v == ['']):
if v[0][0] and v[0][0] == '-':
# Option # Option
opts.append(v[0][1:]) opts.append(v[0][1:])
else: else:

View File

@ -100,7 +100,7 @@ def activate_forum(request):
authinfo = AuthServicesInfoManager.get_auth_service_info(request.user) authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
# Valid now we get the main characters # Valid now we get the main characters
character = EveManager.get_character_by_id(authinfo.main_char_id) character = EveManager.get_character_by_id(authinfo.main_char_id)
result = Phpbb3Manager.add_user(character.character_name, request.user.email, ['REGISTERED']) result = Phpbb3Manager.add_user(character.character_name, request.user.email, ['REGISTERED'], authinfo.main_char_id)
# if empty we failed # if empty we failed
if result[0] != "": if result[0] != "":
AuthServicesInfoManager.update_user_forum_info(result[0], result[1], request.user) AuthServicesInfoManager.update_user_forum_info(result[0], result[1], request.user)
@ -126,7 +126,7 @@ def deactivate_forum(request):
@user_passes_test(service_blue_alliance_test) @user_passes_test(service_blue_alliance_test)
def reset_forum_password(request): def reset_forum_password(request):
authinfo = AuthServicesInfoManager.get_auth_service_info(request.user) authinfo = AuthServicesInfoManager.get_auth_service_info(request.user)
result = Phpbb3Manager.update_user_password(authinfo.forum_username) result = Phpbb3Manager.update_user_password(authinfo.forum_username, authinfo.main_char_id)
# false we failed # false we failed
if result != "": if result != "":
AuthServicesInfoManager.update_user_forum_info(authinfo.forum_username, result, request.user) AuthServicesInfoManager.update_user_forum_info(authinfo.forum_username, result, request.user)

Binary file not shown.

View File

@ -37,9 +37,9 @@
<a class="navbar-brand "> <a class="navbar-brand ">
<div class="fa fa-cog fa-spin"></div> <div class="fa fa-cog fa-spin"></div>
{% if IS_CORP %} {% if IS_CORP %}
<title>{{ CORP_NAME }}</title> {{ CORP_NAME }}
{% else %} {% else %}
<title>{{ ALLIANCE_NAME }}</title> {{ ALLIANCE_NAME }}
{% endif %} {% endif %}
</a> </a>
</div> </div>
@ -102,7 +102,7 @@
<li> <li>
<a {% ifequal request.path "/services/" %} class="active" {% endifequal %} <a {% ifequal request.path "/services/" %} class="active" {% endifequal %}
href="{% url 'auth_services' %}"><i href="{% url 'auth_services' %}"><i
class="fa fa-cogs fa-fw grayiconecolor"></i>Services</a> class="fa fa-cogs fa-fw grayiconecolor"></i> Services</a>
</li> </li>
{% endif %} {% endif %}

View File

@ -1,7 +1,7 @@
{% load staticfiles %} {% load staticfiles %}
<style> <style>
html { html {
background: url("{% static 'img/index_images/index_bg.jpg' %}") no-repeat center center fixed; background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll;
-webkit-background-size: cover; -webkit-background-size: cover;
-moz-background-size: cover; -moz-background-size: cover;
-o-background-size: cover; -o-background-size: cover;
@ -17,15 +17,29 @@
margin-top: -100px; margin-top: -100px;
margin-left: -200px; margin-left: -200px;
} }
#logo {
height: 200px;
width: 900px;
position: fixed;
top: 20%;
left: 50%;
margin-top: -100px;
margin-left: -450px;
}
</style> </style>
<html> <html>
<head lang="en"> <head lang="en">
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>The 99 Percent Eve Alliance</title> <title>My Corp and/or Alliance Name</title>
</head> </head>
<body> <body>
<div id="logo">
<p style="text-align:center">
<img src="{% static 'img/index_images/logo.png' %}" border="0">
</p>
</div>
<div id="content"> <div id="content">
<p style="text-align:center"> <p style="text-align:center">
<a href="/dashboard/"> <a href="/dashboard/">
@ -44,12 +58,6 @@
<img src="{% static 'img/index_images/killboard.png' %}" border="0"> <img src="{% static 'img/index_images/killboard.png' %}" border="0">
</a> </a>
</p> </p>
<p style="text-align:center">
<a href="https://www.youtube.com/playlist?list=PLXM5OIn59G5Gn7eri-lWkXvE15oP5yUUk">
<img src="{% static 'img/index_images/media.png' %}" border="0">
</a>
</p>
</div> </div>
</body> </body>
</html> </html>

View File

@ -23,7 +23,10 @@
<style> <style>
body { body {
background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll; background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll;
background-size: 100% 100%; -webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
} }
.panel-transparent { .panel-transparent {

View File

@ -24,7 +24,10 @@
<style> <style>
body { body {
background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll; background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll;
background-size: 100% 100%; -webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
} }
.panel-transparent { .panel-transparent {

View File

@ -25,7 +25,10 @@
<style> <style>
body { body {
background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll; background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll;
background-size: 100% 100%; -webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
} }
.panel-transparent { .panel-transparent {

View File

@ -24,7 +24,10 @@
<style> <style>
body { body {
background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll; background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll;
background-size: 100% 100%; -webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
} }
.panel-transparent { .panel-transparent {

View File

@ -21,7 +21,10 @@
<style> <style>
body { body {
background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll; background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll;
background-size: 100% 100%; -webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
} }
.panel-transparent { .panel-transparent {

View File

@ -25,7 +25,10 @@
<style> <style>
body { body {
background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll; background: url('{% static 'img/index_images/index_blank_bg.jpg' %}') no-repeat scroll;
background-size: 100% 100%; -webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
} }
.panel-transparent { .panel-transparent {