def register(request): if 'flash' not in request.session: request.session['flash'] = ErrorManager().addToSession() if 'userID' in request.session: return redirect('/') if 'remember' not in request.session: request.session['remember'] = '' if 'login_email' not in request.session: request.session['login_email'] = '' if 'first_name' not in request.session: request.session['first_name'] = '' request.session['last_name'] = '' request.session['email'] = '' request.session['location'] = '' e = getFromSession(request.session['flash']) # msgs=e.getMessages() # print(msgs) context = { 'locations': Location.objects.all(), 'first_name': request.session['first_name'], 'last_name': request.session['last_name'], 'email': request.session['email'], 'location': request.session['location'], 'first_name_errors': e.getMessages('first_name'), 'last_name_errors': e.getMessages('last_name'), 'reg_email_errors': e.getMessages('reg_email'), 'password_errors': e.getMessages('password'), 'confirm_errors': e.getMessages('confirm') } request.session['flash'] = e.addToSession() return render(request, 'clothing_login/register.html', context)
def index(request): # return HttpResponse("hello") if 'flash' not in request.session: request.session['flash'] = ErrorManager().addToSession() e = getFromSession(request.session['flash']) first_name_errors = e.getMessages('first_name') last_name_errors = e.getMessages('last_name') email_errors = e.getMessages('email') password_errors = e.getMessages('password') passc_errors = e.getMessages('passc') email2_errors = e.getMessages('email2') email_login_errors = e.getMessages('email_login') email2_login_errors = e.getMessages('email_login2') pass_login_errors = e.getMessages('pass_login2') request.session['flash'] = e.addToSession() context={ 'first_name_e':first_name_errors, 'last_name_e':last_name_errors, 'email_e': email_errors, 'email2_e': email2_errors, 'password_e':password_errors, 'passc_e':passc_errors, 'email_1':email_login_errors, 'email_2':email2_login_errors, 'pass_log':pass_login_errors } if 'first_name' not in request.session: return render(request, 'handyhelper/index.html', context) else: return redirect('/clear')
def loginorregister(request): if 'flash' not in request.session: request.session['flash'] = ErrorManager().addToSession() e = getFromSession(request.session['flash']) first_name_errors = e.getMessages('first_name') last_name_errors = e.getMessages('last_name') email_errors = e.getMessages('email') password_errors = e.getMessages('password') passc_errors = e.getMessages('passc') email2_errors = e.getMessages('email2') email_login_errors = e.getMessages('email_login') email2_login_errors = e.getMessages('email_login2') pass_login_errors = e.getMessages('pass_login2') request.session['flash'] = e.addToSession() context = { 'first_name_e': first_name_errors, 'last_name_e': last_name_errors, 'email_e': email_errors, 'email2_e': email2_errors, 'password_e': password_errors, 'passc_e': passc_errors, 'email_1': email_login_errors, 'email_2': email2_login_errors, 'pass_log': pass_login_errors } return render(request, 'egg/login.html', context)
def login(request): if 'flash' not in request.session: request.session['flash']=ErrorManager().addToSession() #Add below to all functions if 'adminLoggedIn' not in request.session: request.session['adminLoggedIn']=True if 'userID' not in request.session: return redirect('/admin') if len(User.objects.filter(id=request.session['userID']))==0: return redirect('/admin') if request.session['adminLoggedIn']==False: return redirect('/admin') if User.objects.get(id=request.session['userID']).user_level!=9: return redirect('/admin') #end return redirect('/admin/orders/')
def addjob(request): if 'flash' not in request.session: request.session['flash'] = ErrorManager().addToSession() e = getFromSession(request.session['flash']) title_errors = e.getMessages('title_errors') description_errors = e.getMessages('description_errors') location_errors = e.getMessages('location_errors') request.session['flash'] = e.addToSession() context={ 'title_e':title_errors, 'desc_e':description_errors, 'loc_e': location_errors, } return render(request, 'handyhelper/addjob.html', context)
def index(request): if 'flash' not in request.session: request.session['flash'] = ErrorManager().addToSession() if 'loggedIn' in request.session and request.session['loggedIn'] == True: if 'userID' in request.session and len( User.objects.filter(id=request.session['userID'])) == 1: if User.objects.get(id=request.session['userID']).user_level == 9: return redirect('/main') e = getFromSession(request.session['flash']) context = { 'email_error': e.getMessages('email_error'), 'password_error': e.getMessages('password_error'), 'main_error': e.getMessages('main_error') } request.session['flash'] = e.addToSession() return render(request, 'passenger_server/login.html', context)
def index(request): if 'flash' not in request.session: request.session['flash']=ErrorManager().addToSession() context={'courses':Course.objects.all()} e=getFromSession(request.session['flash']) name_errors=e.getMessages('name') description_errors=e.getMessages('description') deletion_success=e.getMessages('delete') request.session['flash']=e.addToSession() context['deletion_success']=deletion_success context['name_errors']=name_errors context['description_errors']=description_errors return render(request, 'courses/courses.html',context)
def index(request): if 'adminLoggedIn' not in request.session: request.session['adminLoggedIn']=False if 'userID' not in request.session: request.session['userID']=-1 if 'flash' not in request.session: request.session['flash']=ErrorManager().addToSession() if request.session['adminLoggedIn']==True and 'userID' in request.session and len(User.objects.filter(id=request.session['userID']))==1: return redirect('/admin/orders/') e=getFromSession(request.session['flash']) context={ "login_main_errors":e.getMessages('login_main'), "login_email_errors":e.getMessages('login_email'), } request.session['flash']=e.addToSession() return render(request, 'clothing_admin/admin_login.html', context)
def edit(request, numbers): if request.session['id'] != Job.objects.get(id=numbers).user.id: return redirect('/dashboard') if 'flash' not in request.session: request.session['flash'] = ErrorManager().addToSession() e = getFromSession(request.session['flash']) title_errors = e.getMessages('title_errors') description_errors = e.getMessages('description_errors') location_errors = e.getMessages('location_errors') request.session['flash'] = e.addToSession() context={ 'title_e':title_errors, 'desc_e':description_errors, 'loc_e': location_errors, } context = {"jobs": Job.objects.get(id = numbers)} return render(request, 'handyhelper/edit.html', context)
def index(request): if 'flash' not in request.session: request.session['flash'] = ErrorManager().addToSession() if 'userID' in request.session: return redirect('/') if 'remember' not in request.session: request.session['remember'] = '' if 'login_email' not in request.session: request.session['login_email'] = '' e = getFromSession(request.session['flash']) context = { 'login_main_errors': e.getMessages('login_main'), 'login_email_errors': e.getMessages('login_email'), 'reg_good': e.getMessages('reg_good'), 'checked': request.session['remember'], 'login_email': request.session['login_email'] } request.session['flash'] = e.addToSession() return render(request, 'clothing_login/login.html', context)
def index(request): if 'flash' not in request.session: request.session['flash'] = ErrorManager().addToSession() if 'loggedIn' not in request.session: request.session['loggedIn'] = False if 'userID' not in request.session: request.session['userID'] = -1 request.session['systemCheck'] = -1 if request.session['loggedIn'] == True: return redirect('/login/') if 'fName' not in request.session: request.session['fName'] = '' request.session['lName'] = '' request.session['reg_email'] = '' request.session['birthday'] = '' if 'remember' not in request.session: request.session['remember'] = '' if 'log_em' not in request.session: request.session['log_em'] = '' if request.session['loggedIn'] == True: return redirect('/login') e = getFromSession(request.session['flash']) context = { 'reg_fName': e.getMessages('first_name'), 'reg_lName': e.getMessages('last_name'), 'reg_email': e.getMessages('reg_email'), 'birthday': e.getMessages('birthday'), 'reg_pw': e.getMessages('reg_password'), 'confirm': e.getMessages('confirm'), 'reg_success': e.getMessages('reg_success'), 'login_email': e.getMessages('login_email'), 'login_main': e.getMessages('login_main'), 'fName': request.session['fName'], 'lName': request.session['lName'], 'rem_email': request.session['reg_email'], 'bday': request.session['birthday'], 'checked': request.session['remember'], 'log_em': request.session['log_em'], } request.session['flash'] = e.addToSession() return render(request, 'login_registration/loginRegistration.html', context)
def index(request): if 'flash' not in request.session: request.session['flash'] = ErrorManager().addToSession() e = getFromSession(request.session['flash']) first_name_errors = e.getMessages('fname') last_name_errors = e.getMessages('lname') email_errors = e.getMessages('email') pass_errors = e.getMessages('password') conf_errors = e.getMessages('confirm') print(first_name_errors) print(conf_errors, "faweiojfaweiofawefoiawejfwoaie") request.session['flash'] = e.addToSession() context = { 'first_name_e': first_name_errors, 'last_name_e': last_name_errors, 'email_e': email_errors, 'pass_e': pass_errors, 'confirm_e': conf_errors } return render(request, 'login/login.html', context)
def index(request): # ADD to every view if 'loggedIn' not in request.session: return redirect('/login/') if request.session['loggedIn'] == False: return redirect('/login/') if 'userID' not in request.session: return redirect('/login/') if len(User.objects.filter(id=request.session['userID'])) == 0: return redirect('/login/') if 'flash' not in request.session: request.session['flash'] = ErrorManager().addToSession() e = getFromSession(request.session['flash']) context = { 'products': Product.objects.all(), 'user': User.objects.get(id=request.session['userID']), 'shirt_success': e.getMessages('shirt_success'), 'shirt_fail': e.getMessages('shirt_fail'), } request.session['flash'] = e.addToSession() return render(request, 'clothing_dojo/clothingDojo_main.html', context)
def index(request): if 'loggedIn' not in request.session: request.session['loggedIn']=False if request.session['loggedIn']==False: return redirect('/') if 'flash' not in request.session: request.session['flash']=ErrorManager().addToSession() if 'post_failID' not in request.session: request.session['post_failID']=-1 if 'post_goodID' not in request.session: request.session['post_goodID']=-1 e=getFromSession(request.session['flash']) context={ 'post_success':e.getMessages('post_success'), 'post_fail':e.getMessages('post_fail'), 'posts':Post.objects.all().order_by('-created_at'), 'comment_fail':e.getMessages('comment_fail'), 'post_failID':int(request.session['post_failID']), 'comment_success':e.getMessages('comment_success'), 'post_goodID':request.session['post_goodID'], 'first_name':User.objects.get(id=int(request.session['userID'])).first_name } request.session['flash']=e.addToSession() return render(request, 'the_wall/wall.html', context)
def login(request): if 'flash' not in request.session: request.session['flash'] = ErrorManager().addToSession() return redirect('/admin/orders/')