mirror of
https://github.com/not-kennethreitz/convore.json.git
synced 2026-06-21 15:40:58 +00:00
1 line
2.5 KiB
JSON
1 line
2.5 KiB
JSON
[{"user_id": 36639, "stars": [], "topic_id": 41139, "date_created": 1309824162.453968, "message": "The is_new attribute to determine whether to redirect to NEW_USER_REDIRECT was not really working for me, because my application considers a user to really be \"new\" until he/she creates an application-specific profile. Until that profile is created, I want them to be redirected to a special setup page. For the purpose, I modified the code in complete_process() as follows to determine when to redirect:\n\n url = request.session.pop(REDIRECT_FIELD_NAME, '')\n if NEW_USER_REDIRECT and (getattr(user, 'is_new', False) or not has_profile(user)):\n url = NEW_USER_REDIRECT\n elif not url:\n url = DEFAULT_REDIRECT\n\nAnd the has_profile method is simply a exception-handled method as follows:\n\ndef has_profile(user):\n try:\n profile = user.get_profile()\n return True\n except (SiteProfileNotAvailable, ObjectDoesNotExist):\n return False", "group_id": 5196, "id": 1562883}, {"user_id": 36639, "stars": [], "topic_id": 41139, "date_created": 1309824199.322619, "message": "Is this something that others would find useful to be in the social-auth module? Anyone want to add/commit the code? :)", "group_id": 5196, "id": 1562888}, {"user_id": 20656, "stars": [], "topic_id": 41139, "date_created": 1309831927.306411, "message": "@jacobg, I think that profile dependency is too strong to the app, meanwhile, any handler attached to socialauth_registered signal is able to do this profile check and do user.is_new = True in case it doesn't have a profile and your user will get redirected.", "group_id": 5196, "id": 1563815}, {"user_id": 36639, "stars": [], "topic_id": 41139, "date_created": 1309832876.787744, "message": "@omab, I see how your way will also accomplish the same thing. But just a note, that the get_profile method is totally decoupled from the app. It is a Django API call. See the following:\nhttps://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users", "group_id": 5196, "id": 1563936}, {"user_id": 20656, "stars": [], "topic_id": 41139, "date_created": 1309833259.131515, "message": "@jacobg yeah, but not every site uses it, so adding this dependency will make those site mark users as new when they aren't. A setting is needed for this at least.", "group_id": 5196, "id": 1563985}, {"user_id": 36639, "stars": [], "topic_id": 41139, "date_created": 1309866380.3847899, "message": "@omab: I agree a toggle switch setting would be good.", "group_id": 5196, "id": 1566365}] |