def doLogin(request): if request.method != "POST": return HttpResponse("<h2>Method Not Allowed</h2>") else: user = EmailBackEnd.authenticate(request, username=request.POST.get('email'), password=request.POST.get('password')) if user != None: login(request, user) user_type = user.user_type #return HttpResponse("Email: "+request.POST.get('email')+ " Password: "******"Staff Login") return redirect('staff_home') elif user_type == '3': # return HttpResponse("Student Login") return redirect('student_home') else: messages.error(request, "Invalid Login!") return redirect('login') else: messages.error(request, "Invalid Login Credentials!") #return HttpResponseRedirect("/") return redirect('login')
def doLogin(request): if request.method != "POST": return HttpResponse("<h2>Method Not Allowed</h2>") else: captcha_token = request.POST.get("g-recaptcha-response") cap_url = "https://www.google.com/recaptcha/api/siteverify" cap_secret = "*********************************" cap_data = {"secret": cap_secret, "response": captcha_token} cap_server_response = requests.post(url=cap_url, data=cap_data) cap_json = json.loads(cap_server_response.text) if cap_json['success'] == False: messages.error(request, "Invalid Captcha Try Again") return HttpResponseRedirect("/") user = EmailBackEnd.authenticate(request, username=request.POST.get("email"), password=request.POST.get("password")) if user != None: login(request, user) if user.user_type == "1": return HttpResponseRedirect('admin_home/') elif user.user_type == "2": return HttpResponseRedirect(reverse('staff_home')) else: return HttpResponseRedirect(reverse('student_home')) else: messages.error(request, "Invalid Login Details") return HttpResponseRedirect("/")
def doLogin(request): if request.method != "POST": return HttpResponse("<h2>Method Not Allowed</h2>") else: user = EmailBackEnd.authenticate(request, username=request.POST.get('email'), password=request.POST.get('password')) if user != None: login(request, user) user_type = user.user_type if user_type == '1': return redirect('admin_home') elif user_type == '2': # return HttpResponse("Staff Login") return redirect('staff_home') elif user_type == '3': # return HttpResponse("Student Login") return redirect('student_home') else: messages.error(request, "Giriş Edərkən Xəta Baş Verdi!") return redirect('login') else: messages.error(request, "Şifrə və ya Email Yanlışdır!") return redirect('login')
def doLogin(request): if request.method!="POST": return HttpResponse("<h2>Method Not Allowed</h2>") else: user = EmailBackEnd.authenticate(request,username=request.POST.get("email"),password=request.POST.get("password")) if user!=None: login(request,user) if user.user_type=="1": return HttpResponseRedirect('/admin_home') else: messages.error(request,"Invalid Login Details") return HttpResponseRedirect("/")
def dologin(request): if request.method != "POST": return HttpResponse("<h2>Method Not Allowed</h2>") else: user = EmailBackEnd.authenticate(request, username=request.POST.get("email"), password=request.POST.get("password")) if user != None: dj_login(request, user) return HttpResponse("Email:" + request.POST.get("email") + "password:"******"password")) else: messages.error(request, "invalid login details") return HttpResponseRedirect('/')
def doLogin(request): if request.method == 'POST': user = EmailBackEnd.authenticate(request, username=request.POST.get('email'), password=request.POST.get('password')) if user != None: login(request, user) if user.user_type == "1": return HttpResponseRedirect('/admin_home') elif user.user_type == "2": return HttpResponseRedirect(reverse('staff_home')) else: return HttpResponseRedirect(reverse('student_home')) else: messages.error(request, "Invalid Login Details") return HttpResponseRedirect("/") else: return HttpResponse("<h1> method Not Allowed</h1>")
def doLogin(request): if request.method != "POST": return HttpResponse("<h2>Method not allowd</h2>") else: user = EmailBackEnd.authenticate(request, username=request.POST.get("email"), password=request.POST.get("password")) if user != None: login(request, user) if user.user_type == 1: return HttpResponseRedirect("/admin_home") elif user.user_type == 2: return HttpResponseRedirect(reverse("staff_home")) else: return HttpResponseRedirect(reverse("student_home")) else: messages.error(request, "Invalid Login Detials") return HttpResponseRedirect("/")
def doLogin(request): if request.method != "POST": return HttpResponse("<h2>Method not Allowed</h2>") else: user = EmailBackEnd.authenticate(request, username=request.POST.get("email"), password=request.POST.get("password")) if user != None: login(request, user) if user.user_type == "1": return HttpResponseRedirect(reverse('admin_home')) elif user.user_type == "2": return HttpResponseRedirect(reverse("staff_home")) else: return HttpResponseRedirect(reverse("student_home")) # return HttpResponseRedirect('/admin_home') # return HttpResponse("Email : " + request.POST.get("email") + "Password : "******"password")) else: messages.error(request, "Inicio Sesion Invalido Detalles") return HttpResponseRedirect("/")
def doLogin(request): if request.method != "POST": return HttpResponse("<h2>Method not allowed</h2>") else: user = EmailBackEnd.authenticate(request, username=request.POST.get("email"), password=request.POST.get("password")) if user != None: login(request, user) # print(user.user_type) if user.user_type == "1": # print(user.user_type) return HttpResponseRedirect('/admin_home') elif user.user_type == "2": return HttpResponseRedirect(reverse("teacher_home")) else: return HttpResponseRedirect(reverse("student_home")) else: messages.error(request, "Invalid Login Details") # return HttpResponse("<h2>invalid login</h2>") return HttpResponseRedirect("/")