File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,14 @@ public static function login_and_get_token( $username, $password ) {
4747 throw new UserError ( __ ( 'JWT Auth is not configured correctly. Please contact a site administrator. ' , 'wp-graphql-jwt-authentication ' ) );
4848 }
4949
50+ /**
51+ * Do whatever you need before authenticating the user.
52+ *
53+ * @param string $username Username as sent by the user
54+ * @param string $password Password as sent by the user
55+ */
56+ do_action ( 'graphql_jwt_auth_before_authenticate ' , $ username , $ password );
57+
5058 /**
5159 * Authenticate the user and get the Authenticated user object in response
5260 */
@@ -76,7 +84,12 @@ public static function login_and_get_token( $username, $password ) {
7684
7785 /**
7886 * Let the user modify the data before send it back
87+ *
88+ * @param \WP_User $user The authenticated user
89+ * @param array $response The default response
7990 */
91+ $ response = apply_filters ( 'graphql_jwt_auth_after_authenticate ' , $ user , $ response );
92+
8093 return ! empty ( $ response ) ? $ response : [];
8194 }
8295
You can’t perform that action at this time.
0 commit comments