logged in and got logout immediately upon reload the page

240 vues
Accéder directement au premier message non lu

Roy Huang

non lue,
26 févr. 2020, 07:30:1026/02/2020
à Django users
Hi all,

any help will be appreciated, i've bee stuck on this for days, couldnt find answers

ok, here it is,

1) logged in and retrieved data back to a page, all good (got sessionid and csrftoken)

2) make a request on a view which has got @login_required, then got redirect to login (apparently sessionid got cleared )

any thoughts ?

thanks

donkey

Naveen Arora

non lue,
26 févr. 2020, 08:46:3226/02/2020
à Django users
Hi Roy,

Share the exact problem with screenshots and code if possible. Did you set default authentication model of user to yours..?

Cheers,
Naveen Arora

Roy Huang

non lue,
26 févr. 2020, 09:41:2726/02/2020
à Django users
thanks Naveen

wow, how did you even guess that !! yes I did have my own authentication model on top of the original one

I will put up more detail first thing tomorrow at work, so glad somebody can help me out (crying ~~~~~~)

Roy

Naveen Arora於 2020年2月26日星期三 UTC+8下午9時46分32秒寫道:

Naveen Arora

non lue,
27 févr. 2020, 00:57:2827/02/2020
à Django users
All you need to do is set AUTH_USER_MODEL = "Yourapp.yourmodelname" in your setttings.py, delete your entire database and run makemigrations and migrate again.
Django sets the default user model at first migration only.

Hope this helps, you can ask here for your queries.
Cheers,
Naveen Arora

Roy Huang

non lue,
27 févr. 2020, 01:36:3727/02/2020
à Django users
Hi Naveen,

thank you once again for the help

after days of struggling, finally i've got enlightened all of a sudden !

to put it in simple way, 

we have a sync mechanism, which sync local code to production, and we've forgot to exclude db.sqlite3 which accounts resides 

-_- ... what a bummer

thanks Naveen



Naveen Arora於 2020年2月27日星期四 UTC+8下午1時57分28秒寫道:

Naveen Arora

non lue,
28 févr. 2020, 07:19:2228/02/2020
à Django users
cool :)

Cheers,
Naveen Arora
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message