Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 14, 2025. It is now read-only.

Commit31a3f39

Browse files
committed
FIX: do not attempt to fetch user JSON if URL is not set
It is a configuration error to set oauth2_fetch_user_details to true but leave oauth2_user_json_url empty.Before, this resulted in an unhandled exception in core. Now it is checked here.
1 parent05cefd5 commit31a3f39

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

‎plugin.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def after_authenticate(auth, existing_account: nil)
296296
#{auth["extra"].to_hash.to_yaml}
297297
LOG
298298

299-
ifSiteSetting.oauth2_fetch_user_details?
299+
ifSiteSetting.oauth2_fetch_user_details? &&SiteSetting.oauth2_user_json_url.present?
300300
iffetched_user_details=fetch_user_details(auth["credentials"]["token"],auth["uid"])
301301
auth["uid"]=fetched_user_details[:user_id]iffetched_user_details[:user_id]
302302
auth["info"]["nickname"]=fetched_user_details[:username]iffetched_user_details[

‎spec/plugin_spec.rb‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
describeOAuth2BasicAuthenticatordo
66
describe"after_authenticate"do
7+
before{SiteSetting.oauth2_user_json_url="https://provider.com/user"}
8+
79
let(:user){Fabricate(:user)}
810
let(:authenticator){OAuth2BasicAuthenticator.new}
911

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp