def Putout(request): Email = request.POST["email"] Password = request.POST["password"] try: ID = (Database.DP3(Password,Email))[0] token = Authentication.Authenticate(request,ID) Response = redirect('Home') Response.set_cookie("BasicInfo", str(token), max_age = 60*60*24*60) return Response #1.1. - b) If you can´t recognize any user, redirect visitor on the login page except: return redirect('login')
def Identification(packet): headerList = [b'\x00', b'\x01'] #possible values for header print("RECEIVED PACKET: ", packet) print("IDENTIFICATION MODULE") header = packet[0:1] if (header in headerList): if(header == b'\x00'): retPack = parseHandShake(packet) print("returning: ",binascii.hexlify(retPack)) EgressMod.handEgress(retPack) elif(header == b'\x01'): parsePacket = parseService(packet) if not (parsePacket == 1): print("I HAVE A VALID SERVICE PACKET FORMAT") parsePacket['Header'] = header Authentication.Authenticate(parsePacket)
def Putin(FirstName, OtherNames, Password, Birthdate,Email, request): ID = Database.DP2(FirstName,OtherNames,Password,Email,"",Birthdate) token = Authentication.Authenticate(request,ID) Response = redirect('Home') Response.set_cookie("BasicInfo", str(token), max_age = 60*60*24*60) return Response
import Authentication import AdminManage userType=int(input('Select the user type 1.Admin 2.Police Officer 3.User')); if(userType==1): username=input('Username: '******'Password: '******'1.Add employee 2.Delete Employee 3.update Details 4.view Details 5.exit') choice=int(input()) if(choice==1): AdminManage.AddEmployee(input('enter username'),input('enter password'), 2) else: print('wrong username/password') elif(userType==2): username=input('Username: '******'Password: '******'wrong username/password') elif(userType==3): username=input('Username: '******'Password: '******'wrong username/password')