Answer the question
In order to leave comments, you need to log in
Django authorization, theoretical question?
Hello.
I am learning django. I'm doing a custom registration. Made, registered / authorized. But now the question.
I want that authorized users do not get to the authorization pages and password recovery, I want them to be automatically redirected to the account. Should I write a separate check for the user's status (authorized or not) in each function? And there already redirect it where it should be?
And as a matter of fact, the same question is only if the user is not authorized, but can dial the address he needs in his personal account. There it is more or less clear that you can simplify the task and add a decorator @login_required
. But suddenly I'll miss it somewhere and not add this decorator. And an unauthorized user will be able to get where they should not.
How can you specify in one place that "if this is not an authorized user, you are here," and "if you are an authorized user, you are not allowed here"?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question