Commit aca89b48 by Yvon Kerdoncuff

remove probably method index in website/views.py

parent 4e566f82
......@@ -23,89 +23,6 @@ def _get_response_according_credentials(request, credentials, context, template)
response.set_cookie('deconnect_option', 'true')
return response
def index(request):
"""Render main."""
template = loader.get_template('shifts/shift_exchange.html')
# print (make_password(request.POST.get('password')))
# print (check_password('06101998', 'argon2$argon2i$v=19$m=512,t=2,p=2$bTBrSHFoS0JjSGUw$DvhMOtwbYW/qlhkYjW1k0g'))
credentials = CagetteMember.get_credentials(request)
context = {'title': 'Espace Coopérateurs',
'SHIFT_INFO': settings.SHIFT_INFO,
'PB_INSTRUCTIONS': settings.PB_INSTRUCTIONS,
}
context['with_website_menu'] = getattr(settings, 'WITH_WEBSITE_MENU', None)
if ('failure' in credentials):
template = loader.get_template('website/connect.html')
context['msg'] = ''
if 'msg' in credentials:
context['msg'] = credentials['msg']
context['password_placeholder'] = 'Naissance (jjmmaaaa)'
elif ('validation_state' in credentials) and credentials['validation_state'] == 'waiting_validation_member':
template = loader.get_template('members/validation_coop.html')
referer = request.META.get('HTTP_REFERER')
doc = CagetteMember.get_couchdb_data(credentials['login'])
if len(doc) > 1:
context = {'title': 'Validation inscription',
'coop': json.dumps(doc),
'coop_msg': doc.get('coop_msg'),
'warning_placeholder':
"""Signaler ici une anomalie du formulaire,
un problème lié à votre souscription""",
'referer': referer,
'mag_place_string': settings.MAG_NAME,
'office_place_string': settings.OFFICE_NAME,
'max_begin_hour': settings.MAX_BEGIN_HOUR,
'payment_meanings': settings.SUBSCRIPTION_PAYMENT_MEANINGS,
'em_url': settings.EM_URL,
'WELCOME_ENTRANCE_MSG': settings.WELCOME_ENTRANCE_MSG,
'WELCOME_SUBTITLE_ENTRANCE_MSG': getattr(settings, 'WELCOME_SUBTITLE_ENTRANCE_MSG', '')}
if hasattr(settings, 'SUBSCRIPTION_ASK_FOR_SEX'):
context['ask_for_sex'] = settings.SUBSCRIPTION_ASK_FOR_SEX
if hasattr(settings, 'SUBSCRIPTION_ASK_FOR_JOB'):
context['ask_for_job'] = settings.SUBSCRIPTION_ASK_FOR_JOB
if hasattr(settings, 'SUBSCRIPTION_ADD_STREET2'):
context['ask_for_street2'] = settings.SUBSCRIPTION_ADD_STREET2
if hasattr(settings, 'SUBSCRIPTION_ADD_SECOND_PHONE'):
context['ask_for_second_phone'] = settings.SUBSCRIPTION_ADD_SECOND_PHONE
else:
import hashlib
cs = CagetteShift()
if 'id' in request.COOKIES:
partner_id = request.COOKIES['id']
else:
partner_id = credentials['id']
partnerData = cs.get_data_partner(partner_id)
if 'create_date' in partnerData:
md5_calc = hashlib.md5(partnerData['create_date'].encode('utf-8')).hexdigest()
partnerData['verif_token'] = md5_calc
# coop_logger.info(partnerData)
# Following part is a copy of shifts/views.py (def home)
context['partnerData'] = partnerData
days_to_hide = "0"
context['ADDITIONAL_INFO_SHIFT_PAGE'] = getattr(settings, 'ADDITIONAL_INFO_SHIFT_PAGE', '')
if hasattr(settings, 'SHIFT_EXCHANGE_DAYS_TO_HIDE'):
days_to_hide = settings.SHIFT_EXCHANGE_DAYS_TO_HIDE
context['daysToHide'] = days_to_hide
if hasattr(settings, 'CALENDAR_NO_MORE_LINK'):
if settings.CALENDAR_NO_MORE_LINK is True:
context['calendarEventNoMoreLinks'] = True
if hasattr(settings, 'CAL_INITIAL_VIEW'):
context['calInitialView'] = settings.CAL_INITIAL_VIEW
if not (partnerData['cooperative_state'] in state_shift_allowed):
if hasattr(settings, 'UNSUBSCRIBED_MSG'):
context['UNSUBSCRIBED_MSG'] = settings.UNSUBSCRIBED_MSG
template = loader.get_template('shifts/shift_states_not_allowed.html')
else:
# may arrive when switching database without cleaning cookie
return redirect('/website/deconnect')
return _get_response_according_credentials(request, credentials, context, template)
def info_perso(request):
from outils.functions import extract_firstname_lastname
# coop_logger.info('On cherche à accéder à la page info perso')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment