Skip to content

Commit

Permalink
Add application-passwords plugin
Browse files Browse the repository at this point in the history
Add George Stephanis' Application Passwords plugin to allow
authenticating to the WordPress API via alternate tokens. We also add
custom filter handler for 'two_factor_user_api_login_enable' which
disables 2FA prompting when auth is done using an application password.

Bug: T250873
  • Loading branch information
bd808 committed Sep 10, 2020
1 parent 13fb796 commit ea48209
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "plugins/disable-emojis"]
path = plugins/disable-emojis
url = https:/ryanhellyer/disable-emojis
[submodule "plugins/application-passwords"]
path = plugins/application-passwords
url = https:/WordPress/application-passwords.git
15 changes: 13 additions & 2 deletions client-mu-plugins/plugin-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
/*
* We recommend all plugins for your site are
* loaded in code, either from a file like this
* one or from your theme (if the plugins are
* one or from your theme (if the plugins are
* specific to your theme and do not need to be
* loaded as early as this in the WordPress boot
* sequence.
*
*
* @see https://vip.wordpress.com/documentation/vip-go/understanding-your-vip-go-codebase/
*/

Expand Down Expand Up @@ -42,3 +42,14 @@ function cmu_always_multi_author( $transient ) {
return true;
}
add_filter( 'pre_transient_is_multi_author', 'cmu_always_multi_author' );

/**
* Allow api login using application-passwords even when account normally
* requires 2FA authentication.
*/
add_filter( 'two_factor_user_api_login_enable', function( $enable ) {
if ( did_action( 'application_password_did_authenticate' ) ) {
return true;
}
return $enable;
} );
1 change: 1 addition & 0 deletions plugins/application-passwords
Submodule application-passwords added at 0b8990

0 comments on commit ea48209

Please sign in to comment.