Hi,
Need suggestion on how i can implement the below
a user U1 is logged into my website.
he opens incognito mode and again tries to login, expecatation is that his
login will be denied saying you are already logged in.
i tried below but seems not working. ( on stack overflow there are answers
but it's so complex)
```
def login_view(request): form = LoginForm(request.POST or None) msg = None
if request.method == "POST": if form.is_valid(): username =
form.cleaned_data.get("username") password =
form.cleaned_data.get("password") user = authenticate(username=username,
password=password) if request.user.is_authenticated: msg="User already
logged in, multiple log in not allowed " return redirect("/") if user is
not None: login(request, user) return redirect("/") else: msg = 'Invalid
credentials' else: msg = 'Error validating the form' return render(request,
"accounts/login.html", {"form": form, "msg" : msg})
```
Thanks
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/8ccc8131-4a35-450d-9f6c-8d769a0b890cn%40googlegroups.com.