Commit Graph

71 Commits

Author SHA1 Message Date
Usama Sadiq
7710e60328 fix: fix middleware get_response parameter deprecation warning (#33067) 2023-08-22 15:52:30 +05:00
Soban Javed
27edbc6055 fix: added back test_views file 2023-08-15 21:28:43 +05:00
Soban Javed
c45ac51475 fix: update urls and tests for cookies 2023-08-15 21:28:43 +05:00
UsamaSadiq
e332a5660e fix: remove language_session_key usage 2023-08-15 21:28:43 +05:00
Agrendalath
7d3e62e930 fix: use language specified in SiteConfiguration
This feature was implemented in b01544d690 to replace the session's language
in the request. 44ddbdf925 moved the process from the request to the response,
which made this feature unusable (because the request was already processed).
44ddbdf925 also made this feature set the language cookie. However, it is
overwritten by user preferences.
To fix this, we could overwrite the cookie of the response after it's set from
user preferences. However, it is not an ideal solution because when users
switch between Sites with different languages, the first response will use the
language of the previous page. Therefore, this ignores user preferences and
alters the cookie of a request instead.
2022-12-08 13:46:37 +01:00
Régis Behmo
53b8a80668 fix: language cookie "samesite" attribute
The language cookie "samesite" attribute was always set to "None", even in
non-secure environments, such as the devstack. This was causing client-side
warnings in non-https environments, and the language cookie was not properly
set.
2021-12-16 09:04:26 +01:00
edX requirements bot
bb20b17428 Python Requirements Update (#29516)
* chore: Updating Python Requirements

* fix: fix pylint issues

Co-authored-by: Mohammad Ahtasham ul Hassan <mohammad.ahtasham@arbisoft.com>
2021-12-08 14:13:27 +05:00
Usama Sadiq
780a6f3c2d Revert "chore: install codejail from pypi (#29481)" (#29501)
This reverts commit 21551095ac.
2021-12-02 22:19:15 +05:00
Mohammad Ahtasham ul Hassan
21551095ac chore: install codejail from pypi (#29481)
* chore: install codejail from pypi

* chore: Updating Python Requirements

* chore: Updating Python Requirements

* fix: fixed failing tests

* fix: fixed pytest failures

* fix: fixed failing test bug

* Update mocks.py

Co-authored-by: edX requirements bot <testeng+edx-requirements-bot@edx.org>
2021-12-02 17:07:29 +05:00
M. Zulqarnain
834dabb399 feat: New codemods on OpenedX 2 (#28777) 2021-10-28 16:45:53 +05:00
Soban Javed
44ddbdf925 fix: use cookies for storing language instead of session
- Fixed LANGUAGE_COOKIE settings name to LANGUAGE_COOKIE_NAME beacuse later is recognised by django
- Added test to verify cookies use in dark lang middleware
- Fixing Django 3.0 tests
2021-10-04 21:00:29 +05:00
Diana Huang
139e7ba48b feat: Allow language preferences to be shared. (#28277)
We are planning on limiting session cookies for LMS, which
will mean that under the old cookie domain, MFEs and other
IDAs would not have access to the language preference of a user.

This moves language preference cookies to use a different setting,
which means that this cookie can be shared.
2021-07-26 13:36:55 -04:00
uzairr
ac054f92b1 upgrade login api
Modify the existing login api in a way that
it will allow the user to login via username as well.
currently it is only allowing email to log the user in.

VAN-445
2021-05-03 11:38:07 +05:00
Julia Eskew
4462ed37b2 Revert "update login api" (#27416)
This PR might be causing e2e tests to fail. Reverting and merging without waiting on tests.
2021-04-26 10:07:36 -04:00
uzairr
5103f59df9 upgrade login api
Modify the existing login api in a way that
it will allow the user to login via username as well.
currently it is only allowing email to log the user in.

VAN-445
2021-04-23 17:21:18 +05:00
Jawayria
8fc7333982 Refactor: Remove unused imports
Removed unused imports from openedx/core/djangoapps/{dark_lang, django_comment_common, embargo, lang_pref, oauth_dispatch, plugins, programs, schedules}
2021-04-06 17:11:59 +05:00
M. Zulqarnain
c8902bed58 refactor: pyupgrade in heartbeat, lang_pref, models (#26916) 2021-03-16 14:15:01 +05:00
Kyle McCormick
9aefd6f986 style: django-not-configured is not a sensible lint-amnesty value (#26862)
django-not-configured is an error raised by pylint (with
the pylint-django plugin) when it's not correctly configured.

We should not be applying lint amnesty for such a violation.
2021-03-05 08:11:58 -05:00
Aarif
cfcb9330b3 replaced unittest assertions pytest assertions (#26568) 2021-02-22 12:24:33 +05:00
M. Zulqarnain
99c169c444 pylint amnesty in heartbeat,header_control and lang_pref (#26369) 2021-02-04 15:32:10 +05:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Zachary Trabookis
7b3525278e Fix SameSite cookie issue for LTI Provider. EW-449
There was an issue where external LMS system (e.g. Canvas, Blackboard) that used Open edX LTI Provider calls had cookies blocked. This update fixes this issue by defining third-party cookies to have attributes of `Secure=True` and `SameSite=None`.

Details here: https://discuss.openedx.org/t/lti-xblock-and-samesite/759/5

(cherry picked from commit 28479a2966b87b16a25dbc96c19b6f5817d255de)
2020-04-13 17:14:15 +09:30
Aarif
97d327feeb BOM-1121
Old style mixin compatibility with django2.2
2020-01-30 16:36:02 +05:00
Waheed Ahmed
49abac5812 Remove lang cookie for mobile app requests. (#22731)
* Remove lang cookie for mobile app requests.

Responses for mobile app requests must not include language preference cookie.

PROD-1107
2020-01-07 15:49:36 +05:00
Waheed Ahmed
78dabaf2b5 Fix update session language endpoint.
PROD-1107
2020-01-06 18:57:46 +05:00
Feanil Patel
046feb0cf0 Merge pull request #22649 from edx/feanil/fix_pep8
Fix all E303 pep8 errors.
2019-12-30 13:32:26 -05:00
Feanil Patel
6e3fe00fff Fix all E303 pep8 errors. 2019-12-30 12:25:38 -05:00
Feanil Patel
2df8b8226b Merge pull request #22643 from edx/feanil/2to3_asserts
Run `2to3 -f asserts . -w` on edx-platform.
2019-12-30 12:13:42 -05:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Feanil Patel
70294b0ad2 Run 2to3 -f asserts . -w on edx-platform.
https://docs.python.org/3.5/library/2to3.html#2to3fixer-asserts
2019-12-30 10:22:19 -05:00
Bill DeRusha
c76390729d REVERT PR #22152 88e7589a19 2019-10-31 13:06:24 -04:00
uzairr
4efe22c959 Disable language preference cookie to mobile views.
Language preference cookie is not allowing to change the site
language on mobile-apps affecting user-experience.To improve it,
mobile team suggested to disable the language preference cookie
for the request originated from mobile.

PROD-782
2019-10-30 17:12:10 +05:00
Nimisha Asthagiri
f533134db1 Merge pull request #22086 from edx/arch/user-authn-delete-deprecated
User Authn: Remove deprecated, ENABLE_COMBINED_LOGIN_REGISTRATION
2019-10-29 09:37:53 -04:00
Nimisha Asthagiri
db42c7e1e2 User Authn: Remove deprecated, ENABLE_COMBINED_LOGIN_REGISTRATION 2019-10-29 08:57:58 -04:00
adeelehsan
88e7589a19 Logs added to investigate the middleware 2019-10-25 15:27:26 +05:00
Ayub
85be57b64a Merge pull request #21397 from edx/BOM-95
BOM-95
2019-08-22 12:41:08 +05:00
Ayub khan
8a95a8e520 BOM-95
assertItemsEqual with six.assertCountEqual
2019-08-21 17:01:40 +05:00
Feanil Patel
73a146fbbe Revert "assertItemsEqual() moved to assertCountEqual()"
This reverts commit 3d2617983b.

The change was not quite right because the method six provides needs to
have `self` be passed in as well.  See the docs here:
https://six.readthedocs.io/#unittest-assertions

Reverting for now and we can fix it in smaller chunks later.
2019-08-20 15:31:20 -04:00
Dave St.Germain
3d2617983b assertItemsEqual() moved to assertCountEqual() 2019-08-19 17:00:17 -04:00
Dave St.Germain
9d8db8e4ca Convert to utf-8 before JSON decoding 2019-08-19 15:10:56 -04:00
Constanza Abarca
bf0c109b66 INCR-191 2019-04-25 13:51:23 -04:00
Waheed Ahmed
d76a2463fa Add support for beta languages.
Whenever user selects a beta language on account settings page,
show a page level warning message that this language is not
fully translated along with action to revert.

LEARNER-5654
2019-02-06 15:18:04 +05:00
Ned Batchelder
3353e7425e Remove unused imports 2018-11-03 16:07:05 -04:00
Michael Youngstrom
3da94170f5 Switch auth backends for cms as well 2018-10-15 11:14:25 -04:00
Stuart Young
0dd13fad1b add paver timeout decorator and npm installation logs 2018-09-07 08:46:04 -04:00
Michael Youngstrom
bc1d883e1a Dont let DarkLangConfig cache interfere with other tests 2018-09-06 10:33:54 -04:00
Jeremy Bowman
d90afa4cde TE-2689 Remove useless pylint suppressions part 5 2018-08-21 11:07:52 -04:00
Eric Fischer
247bb50ed2 s/django.core.urlresolvers/django.urls/g
Django 1.10 deprecation fix for Hackathon XIX
Addresses PLAT-1397
2018-06-05 13:59:09 -04:00
Eric Fischer
e18448e27d Silence deprecation warnings
https://docs.djangoproject.com/en/1.11/releases/1.10/#using-user-is-authenticated-and-user-is-anonymous-as-methods
2018-05-02 10:03:50 -04:00
Nimisha Asthagiri
38cfadeb20 Schedules: convert course language to supported released language 2017-11-29 20:08:33 -05:00