Changeset 15346
- Timestamp:
- 10/15/2026 06:11:48 PM (9 days ago)
- Location:
- sites/trunk
- Files:
-
- 8 edited
-
api.wordpress.org/public_html/dotorg/freescout/account.php (modified) (1 diff)
-
api.wordpress.org/public_html/dotorg/freescout/common.php (modified) (1 diff)
-
freescout.wordpress.net/Modules/WPOrgSSO/Http/Middleware/RequireWordPressOrgLogin.php (modified) (2 diffs)
-
freescout.wordpress.net/Modules/WPOrgSSO/Public/js/users.js (modified) (2 diffs)
-
freescout.wordpress.net/Modules/WPOrgSSO/README.md (modified) (1 diff)
-
freescout.wordpress.net/Modules/WPOrgSSO/Resources/views/edit_user.blade.php (modified) (1 diff)
-
freescout.wordpress.net/Modules/WPOrgSSO/module.json (modified) (1 diff)
-
freescout.wordpress.net/Modules/WPOrgSSO/tests/UsersTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/dotorg/freescout/account.php
r15261 r15346 39 39 * Whether an account has been blocked from logging in. 40 40 * 41 * Reports true when that can't be determined, so FreeScout refuses the login.42 *43 41 * @param \WP_User $user Account. 44 42 * @return bool 45 43 */ 46 44 function is_blocked( \WP_User $user ): bool { 47 global $nologin_accounts;48 49 45 if ( str_starts_with( $user->user_pass, 'BLOCKED' ) ) { 50 return true;51 }52 53 // Accounts wporg-sso refuses a login.54 if ( ! empty( $nologin_accounts ) && in_array( $user->user_login, (array) $nologin_accounts, true ) ) {55 46 return true; 56 47 } -
sites/trunk/api.wordpress.org/public_html/dotorg/freescout/common.php
r15261 r15346 19 19 */ 20 20 function load_wordpress( string $wp_init_host = '' ): void { 21 // Set by the config this loads, and read by account.php; without this it would stay local to this function.22 global $nologin_accounts;23 24 21 if ( ! $wp_init_host ) { 25 22 $wp_init_host = 'https://api.wordpress.org/'; -
sites/trunk/freescout.wordpress.net/Modules/WPOrgSSO/Http/Middleware/RequireWordPressOrgLogin.php
r15262 r15346 28 28 * - Keeps what comes from WordPress.org, and passwords, out of the profile form. 29 29 * - Deletes a mailbox only when its name was typed in to confirm, since users don't know a FreeScout password. 30 * - Refuses to delete users; they're disabled instead. 30 31 */ 31 32 final class RequireWordPressOrgLogin { … … 169 170 } 170 171 172 if ( 'App\Http\Controllers\UsersController@ajax' === $action && 'delete_user' === $request->input( 'action' ) ) { 173 // A 200, like core's own errors: the dialog only shows the message of those. 174 return response()->json( 175 array( 176 'status' => 'error', 177 'msg' => __( 'Users can’t be deleted. Please disable them instead and remove their mailbox permissions.' ), 178 ) 179 ); 180 } 181 171 182 if ( 'App\Http\Controllers\MailboxesController@ajax' === $action && 'delete_mailbox' === $request->input( 'action' ) ) { 172 183 $error = self::check_mailbox_name( $request, $user ); -
sites/trunk/freescout.wordpress.net/Modules/WPOrgSSO/Public/js/users.js
r15258 r15346 3 3 * 4 4 * - "Create a New User" asks for a WordPress.org username; name and email come from the account. 5 * - The profile doesn't offer to change what WordPress.org keeps up to date, or passwords .5 * - The profile doesn't offer to change what WordPress.org keeps up to date, or passwords, or to delete the user. 6 6 * 7 7 * The server enforces all of this; these only keep the forms from offering it. … … 47 47 ).remove(); 48 48 } 49 50 $( '#delete-user-trigger, #delete_user_modal' ).remove(); 49 51 } ); 50 52 -
sites/trunk/freescout.wordpress.net/Modules/WPOrgSSO/README.md
r15262 r15346 6 6 7 7 - **Logging in:** "Log in with WordPress.org" replaces the password form. The account needs two-factor authentication, and blocked accounts can't log in. Accounts are checked again every hour, so a blocked account loses its session too; if WordPress.org can't be reached, the session goes on until the next check. 8 - **Users:** every FreeScout user is connected to a WordPress.org account. Administrators add users by WordPress.org username, and the name, email, and avatar come from that account. They're updated at every login, and can't be changed in FreeScout. If the WordPress.org email already belongs to another user or a mailbox, the old email stays and a warning is logged. 8 - **Users:** every FreeScout user is connected to a WordPress.org account. Administrators add users by WordPress.org username, and the name, email, and avatar come from that account. They're updated at every login, and can't be changed in FreeScout. On their profile, the username links to their WordPress.org profile. If the WordPress.org email already belongs to another user or a mailbox, the old email stays and a warning is logged. 9 - **Users who leave:** disable them; deleting users is refused. Disabling keeps their mailbox permissions, so remove those by hand. 9 10 - **Existing users:** administrators connect them on their profile, or with `php artisan wporgsso:connect <email> <wporg-username>`. 10 11 - **Passwords:** password logins (except break-glass), resets, and invites are closed. Users have no FreeScout password: new users get none, and logging in with WordPress.org clears the one they had. Only break-glass passwords stay. -
sites/trunk/freescout.wordpress.net/Modules/WPOrgSSO/Resources/views/edit_user.blade.php
r15246 r15346 4 4 <div class="col-sm-6"> 5 5 @if ( $username ) 6 <p class="form-control-static"> {{ $username }}</p>6 <p class="form-control-static"><a href="https://profiles.wordpress.org/{{ rawurlencode( $username ) }}/" target="_blank" rel="noopener">{{ $username }}</a></p> 7 7 @elseif ( $can_connect ) 8 8 <input id="wporgsso-username" type="text" class="form-control input-sized" name="wporg_username" value="{{ old( 'wporg_username', '' ) }}" maxlength="60" autocomplete="off"> -
sites/trunk/freescout.wordpress.net/Modules/WPOrgSSO/module.json
r15313 r15346 4 4 "img": "/modules/wporgsso/img/icon.svg", 5 5 "description": "Signs agents in with their WordPress.org account, and connects every FreeScout user to one.", 6 "version": "1.0. 2",6 "version": "1.0.3", 7 7 "detailsUrl": "https://github.com/WordPress/wordpress.org/tree/trunk/freescout.wordpress.net/Modules/WPOrgSSO", 8 8 "author": "WordPress.org", -
sites/trunk/freescout.wordpress.net/Modules/WPOrgSSO/tests/UsersTest.php
r15258 r15346 366 366 367 367 $this->create( 'rita' )->assertStatus( 403 ); 368 } 369 370 /** 371 * The profile links the username to the WordPress.org profile. 372 * 373 * @return void 374 */ 375 public function test_profile_links_username_to_wordpress_org_profile(): void { 376 $user = $this->create_user( User::ROLE_USER ); 377 Account::connect( (int) $user->id, 'rita' ); 378 379 // The page escapes this, and PHP 8 deprecates escaping null, which tests turn into an exception. 380 $user->emails = ''; 381 $user->save(); 382 383 $this->assertStringContainsString( 384 '<a href="https://profiles.wordpress.org/rita/" target="_blank" rel="noopener">rita</a>', 385 (string) $this->get( route( 'users.profile', array( 'id' => $user->id ) ) )->assertStatus( 200 )->getContent() 386 ); 387 } 388 389 /** 390 * Users can't be deleted, even by administrators; they're disabled instead. 391 * 392 * @return void 393 */ 394 public function test_users_cannot_be_deleted(): void { 395 $user = $this->create_user( User::ROLE_USER ); 396 397 $response = $this->post( 398 route( 'users.ajax' ), 399 array( 400 '_token' => csrf_token(), 401 'action' => 'delete_user', 402 'user_id' => $user->id, 403 ) 404 )->assertStatus( 200 ); 405 406 $this->assertSame( 'error', json_decode( (string) $response->getContent(), true )['status'] ); 407 $this->assertSame( User::STATUS_ACTIVE, (int) $user->refresh()->status ); 368 408 } 369 409
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)