plain.oauth 0.18.0__py3-none-any.whl → 0.19.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,6 @@ from plain.models import migrations
6
6
 
7
7
  class Migration(migrations.Migration):
8
8
  dependencies = [
9
- ("users", "__first__"),
10
9
  ("plainoauth", "0004_alter_oauthconnection_access_token_and_more"),
11
10
  ]
12
11
 
plain/oauth/providers.py CHANGED
@@ -102,10 +102,10 @@ class OAuthProvider:
102
102
  return get_random_string(length=32)
103
103
 
104
104
  def check_request_state(self, *, request: HttpRequest) -> None:
105
- if error := request.GET.get("error"):
105
+ if error := request.query_params.get("error"):
106
106
  raise OAuthError(error)
107
107
 
108
- state = request.GET["state"]
108
+ state = request.query_params["state"]
109
109
  expected_state = request.session.pop(SESSION_STATE_KEY)
110
110
  request.session.save() # Make sure the pop is saved (won't save on an exception)
111
111
  if not secrets.compare_digest(state, expected_state):
@@ -124,8 +124,8 @@ class OAuthProvider:
124
124
  # Store next url in session so we can get it on the callback request
125
125
  if redirect_to:
126
126
  request.session[SESSION_NEXT_KEY] = redirect_to
127
- elif "next" in request.POST:
128
- request.session[SESSION_NEXT_KEY] = request.POST["next"]
127
+ elif "next" in request.data:
128
+ request.session[SESSION_NEXT_KEY] = request.data["next"]
129
129
 
130
130
  # Sort authorization params for consistency
131
131
  sorted_authorization_params = sorted(authorization_params.items())
@@ -138,7 +138,7 @@ class OAuthProvider:
138
138
  return self.handle_login_request(request=request, redirect_to=redirect_to)
139
139
 
140
140
  def handle_disconnect_request(self, *, request: HttpRequest) -> Response:
141
- provider_user_id = request.POST["provider_user_id"]
141
+ provider_user_id = request.data["provider_user_id"]
142
142
  connection = OAuthConnection.objects.get(
143
143
  provider_key=self.provider_key, provider_user_id=provider_user_id
144
144
  )
@@ -149,7 +149,9 @@ class OAuthProvider:
149
149
  def handle_callback_request(self, *, request: HttpRequest) -> Response:
150
150
  self.check_request_state(request=request)
151
151
 
152
- oauth_token = self.get_oauth_token(code=request.GET["code"], request=request)
152
+ oauth_token = self.get_oauth_token(
153
+ code=request.query_params["code"], request=request
154
+ )
153
155
  oauth_user = self.get_oauth_user(oauth_token=oauth_token)
154
156
 
155
157
  if request.user:
@@ -181,7 +183,7 @@ class OAuthProvider:
181
183
  return request.session.pop(SESSION_NEXT_KEY, "/")
182
184
 
183
185
  def get_disconnect_redirect_url(self, *, request: HttpRequest) -> str:
184
- return request.POST.get("next", "/")
186
+ return request.data.get("next", "/")
185
187
 
186
188
 
187
189
  def get_oauth_provider_instance(*, provider_key: str) -> OAuthProvider:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: plain.oauth
3
- Version: 0.18.0
3
+ Version: 0.19.1
4
4
  Summary: OAuth login and API access for Plain.
5
5
  Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
6
6
  License-Expression: BSD-3-Clause
@@ -5,19 +5,19 @@ plain/oauth/config.py,sha256=0Q4IILBKQbIaxqeL9WRTH5Cka-BO3c3SOj1AdQIAJgc,167
5
5
  plain/oauth/default_settings.py,sha256=dlN1J9vSOjjxPNLp-0qe-cLTqwM4E69ZAx_8lpxMhaM,28
6
6
  plain/oauth/exceptions.py,sha256=TMGtIGkK3_J4rsEy1oPCmia7BnRSK8N8RMZm4_pNelA,189
7
7
  plain/oauth/models.py,sha256=ceSw9AKZMXffE4ZKZLxIbOlSyndTCHL22GCuSF3Hpmk,6880
8
- plain/oauth/providers.py,sha256=WMLr9g3S84lfIRFslO0VBCmthMBDQ3GCDLSIquTA_Y0,7138
8
+ plain/oauth/providers.py,sha256=M8r_XkKgyCz8YkLyFyNOt35EHThDvwggcDlUoC7ZYwo,7187
9
9
  plain/oauth/urls.py,sha256=FYzpQwhvZdcat8n3f7RyA-1Q21finKb8JEyakSOjXXg,696
10
10
  plain/oauth/views.py,sha256=dVlFYGsEusD2lr24eVRLVfHfEEreg_1nByepiIOoWLk,3047
11
11
  plain/oauth/migrations/0001_initial.py,sha256=B9Finbn7ijEIUbkDy_B7UsKQLfMWaXd0Kx3oZrUENWc,1753
12
12
  plain/oauth/migrations/0002_alter_oauthconnection_options_and_more.py,sha256=3Mb0IU9KDRQfog0PjVbzuNv_AxCs7UVHnA0F263AKNo,581
13
13
  plain/oauth/migrations/0003_alter_oauthconnection_access_token_and_more.py,sha256=FyLfwxc2pRzF-CbdRFQRRSQTOCxc9l1womgStygm_lo,629
14
14
  plain/oauth/migrations/0004_alter_oauthconnection_access_token_and_more.py,sha256=ho9CG-lf7OVg1vBnjn7miihoioNmOIz7ObxB2QkPeSo,652
15
- plain/oauth/migrations/0005_alter_oauthconnection_unique_together_and_more.py,sha256=3hmuSvIZhn-haEKOGN3lQzcXD7b_Hy0P8Wa7LOAvJ1k,576
15
+ plain/oauth/migrations/0005_alter_oauthconnection_unique_together_and_more.py,sha256=MdTjX5Awff0QPesdAT5JuToitnbphgIh-nsJnZEAAa0,544
16
16
  plain/oauth/migrations/0006_remove_oauthconnection_unique_oauth_provider_user_id_and_more.py,sha256=UjWRezZoAzjVS70oCRQ38k_w6YJtcd_uSYT4Kc3H1pg,713
17
17
  plain/oauth/migrations/0007_alter_oauthconnection_provider_key_and_more.py,sha256=B_LW6xG1o_uA13tqUs0KniXl1JBNbQu4wMh2pW8rq5I,675
18
18
  plain/oauth/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  plain/oauth/templates/oauth/error.html,sha256=xkkWw57sZ3fz4dDfH30SVtq3okJNnJmrSRPfGxrxjh8,108
20
- plain_oauth-0.18.0.dist-info/METADATA,sha256=ofr1VeotNlEmKmKC14GQ-__nZOSNDfbEdeh81mU7Fbk,10304
21
- plain_oauth-0.18.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
- plain_oauth-0.18.0.dist-info/licenses/LICENSE,sha256=cvKM3OlqHx3ijD6e34zsSUkPvzl-ya3Dd63A6EHL94U,1500
23
- plain_oauth-0.18.0.dist-info/RECORD,,
20
+ plain_oauth-0.19.1.dist-info/METADATA,sha256=Iemik0OPAMnSfBFMTCdu6qmDNFQlrgrZhtJiAVmH994,10304
21
+ plain_oauth-0.19.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
22
+ plain_oauth-0.19.1.dist-info/licenses/LICENSE,sha256=cvKM3OlqHx3ijD6e34zsSUkPvzl-ya3Dd63A6EHL94U,1500
23
+ plain_oauth-0.19.1.dist-info/RECORD,,