Django User with is_active=False login via GoogleOAuth2
I have a Django app with login via GoogleOAuth2:
AUTHENTICATION_BACKENDS = (
'social_core.backends.google.GoogleOAuth2',
...
)
When I try to login as a user with User.is_active=True (django.contrib.auth.models.User), it's all OK.
But when I try to login as a user with User.is_active=False, I got nothing. No error, just login page again.
What can be an issue?
How I should handle this error?
python django google-oauth2 django-socialauth
|
show 1 more comment
I have a Django app with login via GoogleOAuth2:
AUTHENTICATION_BACKENDS = (
'social_core.backends.google.GoogleOAuth2',
...
)
When I try to login as a user with User.is_active=True (django.contrib.auth.models.User), it's all OK.
But when I try to login as a user with User.is_active=False, I got nothing. No error, just login page again.
What can be an issue?
How I should handle this error?
python django google-oauth2 django-socialauth
share some code with us please
– py_dude
Dec 27 '18 at 15:01
@py_dude but there are almost no code...social_core.backends.google.GoogleOAuth2does all stuff for me. But it does not work correctly withUser.is_active=False.
– pngnviko
Dec 27 '18 at 15:07
Do you want to let inactive users login or do you want them to be shown an error page that tells them to reactivate their account?
– saad
Dec 27 '18 at 15:51
@saad I want to show them an error.
– pngnviko
Dec 27 '18 at 15:52
RIght. And can your users who use your django based username and password authentication login if their accounts are disabled?
– saad
Dec 27 '18 at 15:54
|
show 1 more comment
I have a Django app with login via GoogleOAuth2:
AUTHENTICATION_BACKENDS = (
'social_core.backends.google.GoogleOAuth2',
...
)
When I try to login as a user with User.is_active=True (django.contrib.auth.models.User), it's all OK.
But when I try to login as a user with User.is_active=False, I got nothing. No error, just login page again.
What can be an issue?
How I should handle this error?
python django google-oauth2 django-socialauth
I have a Django app with login via GoogleOAuth2:
AUTHENTICATION_BACKENDS = (
'social_core.backends.google.GoogleOAuth2',
...
)
When I try to login as a user with User.is_active=True (django.contrib.auth.models.User), it's all OK.
But when I try to login as a user with User.is_active=False, I got nothing. No error, just login page again.
What can be an issue?
How I should handle this error?
python django google-oauth2 django-socialauth
python django google-oauth2 django-socialauth
edited Dec 27 '18 at 15:05
asked Dec 27 '18 at 14:50
pngnviko
466518
466518
share some code with us please
– py_dude
Dec 27 '18 at 15:01
@py_dude but there are almost no code...social_core.backends.google.GoogleOAuth2does all stuff for me. But it does not work correctly withUser.is_active=False.
– pngnviko
Dec 27 '18 at 15:07
Do you want to let inactive users login or do you want them to be shown an error page that tells them to reactivate their account?
– saad
Dec 27 '18 at 15:51
@saad I want to show them an error.
– pngnviko
Dec 27 '18 at 15:52
RIght. And can your users who use your django based username and password authentication login if their accounts are disabled?
– saad
Dec 27 '18 at 15:54
|
show 1 more comment
share some code with us please
– py_dude
Dec 27 '18 at 15:01
@py_dude but there are almost no code...social_core.backends.google.GoogleOAuth2does all stuff for me. But it does not work correctly withUser.is_active=False.
– pngnviko
Dec 27 '18 at 15:07
Do you want to let inactive users login or do you want them to be shown an error page that tells them to reactivate their account?
– saad
Dec 27 '18 at 15:51
@saad I want to show them an error.
– pngnviko
Dec 27 '18 at 15:52
RIght. And can your users who use your django based username and password authentication login if their accounts are disabled?
– saad
Dec 27 '18 at 15:54
share some code with us please
– py_dude
Dec 27 '18 at 15:01
share some code with us please
– py_dude
Dec 27 '18 at 15:01
@py_dude but there are almost no code...
social_core.backends.google.GoogleOAuth2 does all stuff for me. But it does not work correctly with User.is_active=False.– pngnviko
Dec 27 '18 at 15:07
@py_dude but there are almost no code...
social_core.backends.google.GoogleOAuth2 does all stuff for me. But it does not work correctly with User.is_active=False.– pngnviko
Dec 27 '18 at 15:07
Do you want to let inactive users login or do you want them to be shown an error page that tells them to reactivate their account?
– saad
Dec 27 '18 at 15:51
Do you want to let inactive users login or do you want them to be shown an error page that tells them to reactivate their account?
– saad
Dec 27 '18 at 15:51
@saad I want to show them an error.
– pngnviko
Dec 27 '18 at 15:52
@saad I want to show them an error.
– pngnviko
Dec 27 '18 at 15:52
RIght. And can your users who use your django based username and password authentication login if their accounts are disabled?
– saad
Dec 27 '18 at 15:54
RIght. And can your users who use your django based username and password authentication login if their accounts are disabled?
– saad
Dec 27 '18 at 15:54
|
show 1 more comment
1 Answer
1
active
oldest
votes
From the documentation for python-social-auth:
SOCIAL_AUTH_INACTIVE_USER_URL = '/inactive-user/'
Inactive users can be redirected to this URL when trying to authenticate.
You can set this link to a page for inactive users in your settings. Here's the link to the docs
3
Thank you @saad!! You Haley me a lot! Also, you need to set SOCIAL_AUTH_USER_MODEL = 'auth.User' variable to get access to User.is_active.
– pngnviko
Dec 27 '18 at 18:16
2
There is also an entire pipeline of functions that you can customize.
– saad
Dec 28 '18 at 4:50
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53946884%2fdjango-user-with-is-active-false-login-via-googleoauth2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
From the documentation for python-social-auth:
SOCIAL_AUTH_INACTIVE_USER_URL = '/inactive-user/'
Inactive users can be redirected to this URL when trying to authenticate.
You can set this link to a page for inactive users in your settings. Here's the link to the docs
3
Thank you @saad!! You Haley me a lot! Also, you need to set SOCIAL_AUTH_USER_MODEL = 'auth.User' variable to get access to User.is_active.
– pngnviko
Dec 27 '18 at 18:16
2
There is also an entire pipeline of functions that you can customize.
– saad
Dec 28 '18 at 4:50
add a comment |
From the documentation for python-social-auth:
SOCIAL_AUTH_INACTIVE_USER_URL = '/inactive-user/'
Inactive users can be redirected to this URL when trying to authenticate.
You can set this link to a page for inactive users in your settings. Here's the link to the docs
3
Thank you @saad!! You Haley me a lot! Also, you need to set SOCIAL_AUTH_USER_MODEL = 'auth.User' variable to get access to User.is_active.
– pngnviko
Dec 27 '18 at 18:16
2
There is also an entire pipeline of functions that you can customize.
– saad
Dec 28 '18 at 4:50
add a comment |
From the documentation for python-social-auth:
SOCIAL_AUTH_INACTIVE_USER_URL = '/inactive-user/'
Inactive users can be redirected to this URL when trying to authenticate.
You can set this link to a page for inactive users in your settings. Here's the link to the docs
From the documentation for python-social-auth:
SOCIAL_AUTH_INACTIVE_USER_URL = '/inactive-user/'
Inactive users can be redirected to this URL when trying to authenticate.
You can set this link to a page for inactive users in your settings. Here's the link to the docs
answered Dec 27 '18 at 16:05
saad
6101613
6101613
3
Thank you @saad!! You Haley me a lot! Also, you need to set SOCIAL_AUTH_USER_MODEL = 'auth.User' variable to get access to User.is_active.
– pngnviko
Dec 27 '18 at 18:16
2
There is also an entire pipeline of functions that you can customize.
– saad
Dec 28 '18 at 4:50
add a comment |
3
Thank you @saad!! You Haley me a lot! Also, you need to set SOCIAL_AUTH_USER_MODEL = 'auth.User' variable to get access to User.is_active.
– pngnviko
Dec 27 '18 at 18:16
2
There is also an entire pipeline of functions that you can customize.
– saad
Dec 28 '18 at 4:50
3
3
Thank you @saad!! You Haley me a lot! Also, you need to set SOCIAL_AUTH_USER_MODEL = 'auth.User' variable to get access to User.is_active.
– pngnviko
Dec 27 '18 at 18:16
Thank you @saad!! You Haley me a lot! Also, you need to set SOCIAL_AUTH_USER_MODEL = 'auth.User' variable to get access to User.is_active.
– pngnviko
Dec 27 '18 at 18:16
2
2
There is also an entire pipeline of functions that you can customize.
– saad
Dec 28 '18 at 4:50
There is also an entire pipeline of functions that you can customize.
– saad
Dec 28 '18 at 4:50
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53946884%2fdjango-user-with-is-active-false-login-via-googleoauth2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
share some code with us please
– py_dude
Dec 27 '18 at 15:01
@py_dude but there are almost no code...
social_core.backends.google.GoogleOAuth2does all stuff for me. But it does not work correctly withUser.is_active=False.– pngnviko
Dec 27 '18 at 15:07
Do you want to let inactive users login or do you want them to be shown an error page that tells them to reactivate their account?
– saad
Dec 27 '18 at 15:51
@saad I want to show them an error.
– pngnviko
Dec 27 '18 at 15:52
RIght. And can your users who use your django based username and password authentication login if their accounts are disabled?
– saad
Dec 27 '18 at 15:54