django-authentication

Authentication in Android

此生再无相见时 提交于 2019-12-05 02:06:03
问题 I am developing an Django based web application with a client android app. On the web side the authentication is done with the help of session id stored in cookies(the default Django implementation). But I am not able to figure out how to authenticate the user in android client. The available options are to go with the same session/cookies or Tokens. Tokens can be OAuth or just simple tokens. The points that I am not able to understand are these Whats the problem in sessions authentication??

Create user inactive as default (is_active default False)

可紊 提交于 2019-12-04 23:59:25
问题 I have facebook authentication in my website which I use omab / django-social-auth I want to redirect users to another website to make them fill their details. So I want to have users as inactive when they first authenticate with their facebook accounts, then after they complete the form I save them as active users. I manipulated the django/contrib/auth/models.py under my enviroment as with is_active fields as default=False; but they are saved as active user but still the same result, even I

Android with Django: How to keep user logged in

心不动则不痛 提交于 2019-12-04 18:19:55
I want to know what the method used by popular apps are. Here are the approaches I have considered: When user logs in, save username & password in shared preferences and re-use it every time ( I think this will suck ) Login on the client(app) side with Facebook SDK, pass the authentication token to the app and use that to create a user. Pass a token to the app, store this token on the phone and use it in future communications. I think it would make sense to re-create this token periodically, but how to do so without asking the user to login again? Create a login view. this will mean passing

Adding user to group on creation in Django

随声附和 提交于 2019-12-04 15:55:10
I'm looking to add a User to a group only if a field of this User is specified as 'True' once the User is created. Every User that is created would have a 'UserProfile' associated with it. Would this be the correct way to implement such a thing? models.py: def add_group(sender, instance, created, **kwargs): if created: sender = UserProfile if sender.is_in_group: from django.contrib.auth.models import Group g = Group.objects.get(name='Some Group') g.user_set.add(sender) post_save.connect(add_group, sender=UserProfile) Thanks in advance! Another option is using a post_save signal from django.db

django-allauth: How to set user to active only after e-mail verification

馋奶兔 提交于 2019-12-04 13:43:02
问题 I'm using django-allauth primarily as a way to create user accounts for the admin backend. What I would like to have happen is: 1) When a user goes through the sign up procedure, send out the verification e-mail (I have this working so far) and set the user as inactive, staff, and with the "SurveyManager" group assigned to them by defult. Currently, the user is created with active set to true, staff set to false, and no groups assigned. 2) After clicking the link in their e-mail to verify

how to create a group permission in django

╄→гoц情女王★ 提交于 2019-12-04 12:19:06
问题 I am attempting to create a row in the auth_group_permission table. I have tried the following: group_permission = group_permissions.add(group=group, permission=permission) group_permission = group.group_permissions_set.add(permission=permission) group_permission = group.permissions_set.add(permission=permission) None of these work. Does anyone know how to add a record to this table? 回答1: The following answer helped me in setting up groups. from django.contrib.auth.models import User, Group,

Login to webpage from script using Requests and Django

ε祈祈猫儿з 提交于 2019-12-04 03:25:46
I have written a web application in Django. I need to post some data to a form from a python script. The post (r2) works correctly when login is disabled. I have the request working correctly for the login (r1), but it gives me a 404 error now for the form post (r2). The login doesn't appear to be carried over to the second request. The csrftoken and sessionid are hardcoded for testing because it wasn't recognizing them. Relevant code (url base removed): url_login='../pecasRunLog/accounts/login/' url_add_run='../pecasRunLog/model/'+region+'/add_run/' client = requests.session() client.get(url

Django : Syncdb incorrectly warns that many-to-many field is stale

穿精又带淫゛_ 提交于 2019-12-04 02:27:34
I have a django application where one application has many-to-many relationship with a UserProfile. But whenever I do a syncdb, it warns me that app_users is stale field The following content types are stale and need to be deleted: Apps | app_users #settings.py AUTH_PROFILE_MODULE = 'kprofile.UserProfile' #Apps/models.py class app(models.Model): .... users = models.ManyToManyField(UserProfile) Now I don't use UserProfile inside view except for some authentication purposes inside rules. And a UserProfile can be attached to an App only from admin interface. How can I stop django syncdb from

How to make Django REST JWT Authentication scale with mulitple webservers?

时光总嘲笑我的痴心妄想 提交于 2019-12-03 20:51:57
I currently have a Django app that is simply a bunch of REST APIs (backed by a database of course). I am managing my authentications with Django REST framework JWT . It's working fine. Whenever a user logs in, one of my API returns a token that the consuming application stores for later usage. So far so good. However, in the future, this solution will need to scale. And instead of having a single server running the Django app, I can forsee a situation when I will need multiple Webservers. Of course all those webservers will be connected to the same Database. But since the token is not stored

Authentication in Android

空扰寡人 提交于 2019-12-03 17:23:09
I am developing an Django based web application with a client android app. On the web side the authentication is done with the help of session id stored in cookies(the default Django implementation). But I am not able to figure out how to authenticate the user in android client. The available options are to go with the same session/cookies or Tokens. Tokens can be OAuth or just simple tokens. The points that I am not able to understand are these Whats the problem in sessions authentication?? Does no use it for their mobile apps? What are the advantages of using Tokens over the session thing?