def post(self, request): uname = request.POST["username"] upass = request.POST['password'] user = authenticate(username=uname, password=upass) if user is None: messages.info(request, "Username or Password in not correct") return redirect('/login/') else: authorize(request, user) return redirect('/')
def lumilogin(request): if request.method == 'POST': username=request.POST['username']; password=request.POST['password']; if(username is not None or password is not None): user = authenticate(request, username=username, password=password) # if user is not authenticated if (user is not None): authorize(request, user) return render (request,'lumi1.html'); else: return render(request,'auth/LumiLogin.html'); else: return render(request,'auth/LumiLogin.html');
def login(request): if (request.method == 'POST'): form = AuthenticationForm() uname = request.POST['username'] upass = request.POST['password'] user = authenticate(username=uname, password=upass) if user is None: messages.info(request, 'Username and Password is not Correct') return redirect('/user/login') else: authorize(request, user) return redirect('/user/profile') else: if (request.user.is_authenticated): return redirect('/user/profile') form = AuthenticationForm() return render(request, 'login.html', {'title': 'User Login', 'form': form})
def login(request): if request.method == "POST": # form=AuthenticationForm() uname = request.POST['username'] upass = request.POST['password'] user = authenticate(username=uname, password=upass) if user is None: messages.info(request, 'user or password is not correct') return redirect('/user/login') else: authorize(request, user) return redirect('/user/profile') else: if request.user.is_authenticated: return redirect('/user/profile') form = AuthenticationForm() return render(request, 'login.html', {'form': form})
def login(request): form = AuthenticationForm() if request.method == 'POST': uname = request.POST['username'] upwd = request.POST['password'] user = authenticate(username=uname, password=upwd) if user is None: messages.info(request, 'Please check credentials') else: # this will create the session for loged in user authorize(request, user) return redirect('/user/profile') # return HttpResponse('login ') else: if request.user.is_authenticated: return redirect('/user/profile') data = {'form': form, 'title': 'Login'} return render(request, 'dj_login.html', data)
def login(request): form = AuthenticationForm() if request.method == "POST": uname = request.POST['username'] upass = request.POST['password'] user = authenticate(username=uname, password=upass) if user.is_authenticated: authorize(request, user) return HttpResponseRedirect('/user/profile/') else: messages.info( request, "Username or password is not correct please try again") return HttpResponseRedirect('/user/login/') else: if request.user: return HttpResponseRedirect('/user/profile/') else: return render(request, 'user/login.html', {'form': form})
def login(request): form = AuthenticationForm() if(request.method == 'POST'): form = AuthenticationForm() username=request.POST['username'] password=request.POST['password'] user =authenticate(username=username,password=password); if user is None: messages.add_message(request,messages.INFO,'Username or Password is not valid ') return redirect('/login') else: authorize(request,user) return redirect('/home') else: if(request.user.is_authenticated): return redirect('/home') form = AuthenticationForm() return render(request, 'auth/login.html', {'title': 'Login', 'form': form})
def login(request): if (request.method == 'POST'): form = AuthenticationForm() username = request.POST['username'] password = request.POST['password'] user = authenticate(username=username, password=password) if user is None: messages.info(request, "The username and password doesn't match") return redirect('/user/login') else: authorize(request, user) return redirect('/user/profile') else: if (request.user.is_authenticated): return redirect('/user/profile/') form = AuthenticationForm() return render(request, 'login.html', { 'titile': 'titale login page', 'form': form })
def login(request): if request.method == "POST": # form=AuthenticationForm() uname = request.POST['username'] upass = request.POST['password'] user = authenticate(username=uname, password=upass) if user is None: messages.info(request, 'user or password is not correct') return redirect('/user/login') else: authorize(request, user) now = timezone.now() A_p = ActivityPeriod.objects.create(user=user, start_time=now) request.session['s_ud'] = A_p.id return redirect('/user/profile') else: if request.user.is_authenticated: return redirect('/user/profile') form = AuthenticationForm() return render(request, 'login.html', {'form': form})