How to use django login_required decorator for custom authentication backend?

2020-06-07 Thread reasm
Hi, I have created an authentication backend that allows users to login using their username, password and institute id. Although the user can login but it doesn’t get access to the view with login_required decor. When I login to the site it redirects to this url: '

Re: login_required decorator in Django: open modal instead of redirecting to another page

2015-04-14 Thread Avraham Serour
ve a django app which has certain sections which are reserved for >> registered users. I have the views annotated with login_required decorator >> which redirects the user to a login page. >> >> However, I would like to keep the user on the same page and open up a >>

Re: login_required decorator in Django: open modal instead of redirecting to another page

2015-04-13 Thread Roh Codeur
I ended up going with Avraham's response in this. On Thursday, 9 April 2015 01:53:35 UTC+1, Roh Codeur wrote: > > Hi > > I have a django app which has certain sections which are reserved for > registered users. I have the views annotated with login_required decorator > which

Re: login_required decorator in Django: open modal instead of redirecting to another page

2015-04-09 Thread Avraham Serour
, 2015 at 10:25 PM, Roh Codeur <behl.ro...@gmail.com> wrote: > Hi > > I have a django app which has certain sections which are reserved for > registered users. I have the views annotated with login_required decorator > which redirects the user to a login page. > > Ho

login_required decorator in Django: open modal instead of redirecting to another page

2015-04-08 Thread Roh Codeur
Hi I have a django app which has certain sections which are reserved for registered users. I have the views annotated with login_required decorator which redirects the user to a login page. However, I would like to keep the user on the same page and open up a modal dialog prompting user

Re: Using login_required decorator

2014-12-02 Thread Rootz
Thanks I got it to work... On Tuesday, December 2, 2014 7:22:30 AM UTC-5, Daniel Roseman wrote: > > On Monday, 1 December 2014 23:59:00 UTC, Rootz wrote: >> >> I have a small project but I am trying to restrict access on some of the >> django app urls to login users only. The problem is that

Re: Using login_required decorator

2014-12-02 Thread Daniel Roseman
On Monday, 1 December 2014 23:59:00 UTC, Rootz wrote: > > I have a small project but I am trying to restrict access on some of the > django app urls to login users only. The problem is that when I hit a page > that requires login users I expected that they(users) are redirected to the > login

Re: Using login_required decorator

2014-12-01 Thread JJ Zolper
The best way to require login to certain url and view hooks is the: @login_required decorator. Let me show you how I have it setup: My "Profile" view is the profile a user sees once they are logged in to then have the ability to edit their information so obviously this needs to have

Using login_required decorator

2014-12-01 Thread Rootz
I have a small project but I am trying to restrict access on some of the django app urls to login users only. The problem is that when I hit a page that requires login users I expected that they(users) are redirected to the login page however that is not the case of what happens instead they

Re: More robust way of handling login_required decorator?

2013-07-13 Thread shmengie
AUTH_REQUIRED = True/False # default False for backward compatibility Normal behaviour unless assigned a pointer to Login CBV or FBV that returns user to the original URI upon successful login. I suspect this needs to be posted on the Developer forum. -Joe -- You received this message

Re: More robust way of handling login_required decorator?

2013-07-13 Thread shmengie
: > > I make heavy use the login_required decorator and for the most part it > is extremely easy to use when using FBVs but when using CBVs one either > has to add a dispatch method to the class calling the super classes > dispatch method or you need to put the login_requ

Re: More robust way of handling login_required decorator?

2013-07-13 Thread Some Developer
On 13/07/13 14:50, Peith Vergil wrote: django-braces have a LoginRequiredMixin. Using it is a much cleaner solution to overriding the dispatch method. Thanks for the tip. I'll check it out. -- You received this message because you are subscribed to

Re: More robust way of handling login_required decorator?

2013-07-13 Thread Peith Vergil
django-braces <https://github.com/brack3t/django-braces> have a LoginRequiredMixin. Using it is a much cleaner solution to overriding the dispatch method. On Sat, Jul 13, 2013 at 6:56 PM, Some Developer <someukdevelo...@gmail.com>wrote: > I make heavy use the login_req

More robust way of handling login_required decorator?

2013-07-13 Thread Some Developer
I make heavy use the login_required decorator and for the most part it is extremely easy to use when using FBVs but when using CBVs one either has to add a dispatch method to the class calling the super classes dispatch method or you need to put the login_required in the url configuration

Re: Two user account types and login_required decorator

2010-03-19 Thread Paulo Almeida
where one part is customer database with > accounts and settings for internal access, the second part is customer > access with different interface and functionality. For internal access I am > using django.contrib.auth and login_required decorator. This decorator > redirect the user to

Two user account types and login_required decorator

2010-03-19 Thread Martin Tiršel
Hello, I am programming an application where one part is customer database with accounts and settings for internal access, the second part is customer access with different interface and functionality. For internal access I am using django.contrib.auth and login_required decorator

Re: @login_required decorator sends me to the wrong URL

2009-11-19 Thread Preston Holmes
http://docs.djangoproject.com/en/1.1/ref/settings/#login-url There are going to be some other places you will have to be careful running django on a path other than / -Preston On Nov 19, 7:11 am, Stodge <sto...@gmail.com> wrote: > I added the @login_required decorator t

@login_required decorator sends me to the wrong URL

2009-11-19 Thread Stodge
I added the @login_required decorator to my view but it redirects me to: http://localhost/accounts/login whereas the URL for my site is: http://localhost/test/accounts/login This is on Apache. Did I forget to configure something in settings.py? Thanks -- You received this message because

Re: best option to override login_required decorator

2009-09-16 Thread Karen Tracey
On Wed, Sep 16, 2009 at 4:53 AM, Robert <rober...@gmail.com> wrote: > > As a business requirement we have to show login form in an ajax > response for some login_required actions. I want to change the > login_required decorator to behaive differently in case the request is

best option to override login_required decorator

2009-09-16 Thread Robert
As a business requirement we have to show login form in an ajax response for some login_required actions. I want to change the login_required decorator to behaive differently in case the request is an ajax request and not a normal GET / POST request. What do you think is the best way to override

Re: Using the @login_required() decorator with #hash url's

2009-07-28 Thread Jumpfroggy
> The only way I know around this involves leaning on JavaScript to > get the URL, split off the #hash bit from it, and sneak it in as > a hidden element on the login form. Yeah, I ended up doing this on the /login page. Basically: $(function() {

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Tim Chase
> The first problem is that the django server only receives the '/page' > part of the URL. The browser itself holds onto the '#hash' part and > doesn't transmit that to the django server at all, so the > login_required() decorator calls request.get_full_path() and gets '/ > page',

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Javier Guerra
On Thu, Jul 16, 2009 at 4:08 PM, Tom Evans wrote: >> 1: no #section1 in the HTML => Django is losing it, should be fixed > > Re-read the thread. The #part of the URL is not something ever > transmitted beyond the browser. No web application ever sees the #part > of a

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Michael
On Thu, Jul 16, 2009 at 12:00 PM, Javier Guerra wrote: > > On Thu, Jul 16, 2009 at 3:51 PM, Michael wrote: > > This information isn't transmitted to the server in anyway so short of > what > > you described above, Django can't really solve your issue. >

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Tom Evans
On Thu, 2009-07-16 at 16:00 +, Javier Guerra wrote: > On Thu, Jul 16, 2009 at 3:51 PM, Michael wrote: > > This information isn't transmitted to the server in anyway so short of what > > you described above, Django can't really solve your issue. > > but where is it

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Javier Guerra
On Thu, Jul 16, 2009 at 3:51 PM, Michael wrote: > This information isn't transmitted to the server in anyway so short of what > you described above, Django can't really solve your issue. but where is it getting lost? i mean, what does the html looks like? does it have the

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Michael
the '/page' > part of the URL. The browser itself holds onto the '#hash' part and > doesn't transmit that to the django server at all, so the > login_required() decorator calls request.get_full_path() and gets '/ > page', so that's what it uses. It doesn't look like there's a simple >

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Jumpfroggy
he django server at all, so the login_required() decorator calls request.get_full_path() and gets '/ page', so that's what it uses. It doesn't look like there's a simple way to get the '#hash' from django. Once I get it, yes I can use urlencode(full_path_with_hash) and use tha

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Javier Guerra
On Thu, Jul 16, 2009 at 2:58 PM, Jumpfroggy<rocketmonk...@gmail.com> wrote: > > Currently, the @login_required() decorator does not preserve any #hash > part of the URL.  So if I go to /page#section1 without being logged > in, I'm redirected to /login?next=/page#section1.  After

Using the @login_required() decorator with #hash url's

2009-07-16 Thread Jumpfroggy
Currently, the @login_required() decorator does not preserve any #hash part of the URL. So if I go to /page#section1 without being logged in, I'm redirected to /login?next=/page#section1. After logging in, I'm redirected to /page (without the hash part). I read in another thread here

Re: vanilla login_required decorator not strict enough to rely on?

2008-07-16 Thread Egon Esser
Right now I'd just like to know if there is anyone at all anymore that wrote a custom/extended login_required decorator and what type of extension and the exact need for it (motivation) was. Thx, folks! --~--~-~--~~~---~--~~ You received this message because you

vanilla login_required decorator not strict enough to rely on?

2008-07-09 Thread Egon Esser
, attempted to browse to a page of my site that would provoke calling a view function protectd by the login_required decorator (for example, a user's own profile page). Normally this gives back a result as expected (redirection to login page) due to is_anonymous returning True and is_authenticated

Re: login_required decorator

2007-02-20 Thread Frank Tegtmeyer
Malcolm Tredinnick <[EMAIL PROTECTED]> writes: > next day or two in order to make this (and a couple of other > login-related URLs) directly configurable via settings.py. What I need is several different login pages at one site. So the parameter (or the workaround with user_passes_test) is what

Re: login_required decorator

2007-02-20 Thread Malcolm Tredinnick
On Tue, 2007-02-20 at 10:09 -0800, ScottB wrote: > Hi Frank. > > > is there any reason that the login_required decorator doesn't have the > > login_url parameter? > > If you want to set the login url to something other than the default / > accounts/login/ you a

Re: login_required decorator

2007-02-20 Thread ScottB
Hi Frank. > is there any reason that the login_required decorator doesn't have the > login_url parameter? If you want to set the login url to something other than the default / accounts/login/ you add this to your settings.py: from django.contrib.auth import LOGIN_URL LOGIN_URL = '/ac

Re: login_required decorator

2007-02-19 Thread Lawrence Oluyede
> is there any reason that the login_required decorator doesn't have the > login_url parameter? I think it's a known issue > The other decorators have it. Besides me there seem to be also other > people who need this parameter (see the comments to the auth docs > page). In the m

login_required decorator

2007-02-19 Thread Frank Tegtmeyer
Hi, is there any reason that the login_required decorator doesn't have the login_url parameter? The other decorators have it. Besides me there seem to be also other people who need this parameter (see the comments to the auth docs page). Regards, Frank

Re: passing arguments to the login_required decorator

2007-02-07 Thread Georgi Stanojevski
Mike H напиша: > I am using the login_required decorator form > django.contrib.auth.decorators, but I want to override the second > argument which specified which url it should redirect to if the user is > not logged in. It's not messy to write your own. login_requir

Re: passing arguments to the login_required decorator

2007-02-07 Thread Lawrence Oluyede
> How can I pass in the user to authenitcate and the login url arguments to > the decorator directly? You can simply use your own decorator and not the Django's. Take the django login_required decorator and modify it accordingly to your needs. You need to change the LOGIN_URL constant.

passing arguments to the login_required decorator

2007-02-07 Thread Mike H
Hi all, I am using the login_required decorator form django.contrib.auth.decorators, but I want to override the second argument which specified which url it should redirect to if the user is not logged in. I'm pretty new to python and everything I've tried so far has just resulted in a syntax

Re: login_required decorator conflicts with admin documentation view

2007-01-05 Thread James Bennett
On 1/6/07, James Bennett <[EMAIL PROTECTED]> wrote: What's needed to actually make this work is for user_passes_test to copy over __module__ and __name__ from the decorated function to its internal _checklogin function, in addition to __doc__. Also, it's worth pointing out that this has

Re: login_required decorator conflicts with admin documentation view

2007-01-05 Thread James Bennett
On 1/6/07, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: On 06-Jan-07, at 11:32 AM, chasfs wrote: > Any suggestions other than removing the login_required decorator and > doing the work in each view? use user_passes_test - this has an option for adding the return url Unfortunately

Re: login_required decorator conflicts with admin documentation view

2007-01-05 Thread Kenneth Gonsalves
On 06-Jan-07, at 11:32 AM, chasfs wrote: Any suggestions other than removing the login_required decorator and doing the work in each view? use user_passes_test - this has an option for adding the return url -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web

login_required decorator conflicts with admin documentation view

2007-01-05 Thread chasfs
I'm having a problem using the auto generated admin documentation for views, when the view has an @login_required decorator. Instead of linking to the doc for the view, the link is to: http://localhost:8000/admin/doc/views/django.contrib.admin.views.decorators._checklogin/ which is not found

Re: problem with login_required decorator in python2.3

2006-03-17 Thread Kenneth Gonsalves
On Friday 17 Mar 2006 6:20 pm, Les Smithson wrote: > Write you own login_required and use that as a decorator: > > from django.views.decorators.auth import user_passes_test, > login_required > mylogin_required = user_passes_test(lambda u: not > u.is_anonymous(), login_url="/my/login/") simpler

Re: problem with login_required decorator in python2.3

2006-03-17 Thread Kenneth Gonsalves
On Friday 17 Mar 2006 6:20 pm, Les Smithson wrote: > Write you own login_required and use that as a decorator: > > from django.views.decorators.auth import user_passes_test, > login_required > mylogin_required = user_passes_test(lambda u: not > u.is_anonymous(), login_url="/my/login/") > >

Re: problem with login_required decorator in python2.3

2006-03-17 Thread Kenneth Gonsalves
On Friday 17 Mar 2006 5:43 pm, Amit Upadhyay wrote: > Monkey patching: > > If you find > login_requiredication/#the-login-required-decorator>decorator enough for your > needs, but do not like the /accounts/login/ url, you can edit >

problem with login_required decorator in python2.3

2006-03-17 Thread Kenneth Gonsalves
hi, my site is on "/web/', so for example, my home page is: http://mysite.com/web/home/ and admin is in: http://mysite.com/web/admin/ but using login_required decorator, the thing is directed to: http://mysite.com/accounts/login/ when i want it to go to http://mysite.com/web/login/