- Timestamp:
- 04/16/2019 05:08:16 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-recovery-mode-link-service.php
r44973 r45211 38 38 * 39 39 * @param WP_Recovery_Mode_Cookie_Service $cookie_service Service to handle setting the recovery mode cookie. 40 * @param WP_Recovery_Mode_Key_Service $key_service Service to handle generating recovery mode keys. 40 41 */ 41 public function __construct( WP_Recovery_Mode_Cookie_Service $cookie_service ) {42 public function __construct( WP_Recovery_Mode_Cookie_Service $cookie_service, WP_Recovery_Mode_Key_Service $key_service ) { 42 43 $this->cookie_service = $cookie_service; 43 $this->key_service = new WP_Recovery_Mode_Key_Service();44 $this->key_service = $key_service; 44 45 } 45 46 … … 54 55 */ 55 56 public function generate_url() { 56 $key = $this->key_service->generate_and_store_recovery_mode_key(); 57 $token = $this->key_service->generate_recovery_mode_token(); 58 $key = $this->key_service->generate_and_store_recovery_mode_key( $token ); 57 59 58 return $this->get_recovery_mode_begin_url( $ key );60 return $this->get_recovery_mode_begin_url( $token, $key ); 59 61 } 60 62 … … 71 73 } 72 74 73 if ( ! isset( $_GET['action'], $_GET['rm_ key'] ) || self::LOGIN_ACTION_ENTER !== $_GET['action'] ) {75 if ( ! isset( $_GET['action'], $_GET['rm_token'], $_GET['rm_key'] ) || self::LOGIN_ACTION_ENTER !== $_GET['action'] ) { 74 76 return; 75 77 } … … 79 81 } 80 82 81 $validated = $this->key_service->validate_recovery_mode_key( $_GET['rm_ key'], $ttl );83 $validated = $this->key_service->validate_recovery_mode_key( $_GET['rm_token'], $_GET['rm_key'], $ttl ); 82 84 83 85 if ( is_wp_error( $validated ) ) { … … 97 99 * @since 5.2.0 98 100 * 99 * @param string $key Recovery Mode key created by {@see generate_and_store_recovery_mode_key()} 101 * @param string $token Recovery Mode token created by {@see generate_recovery_mode_token()}. 102 * @param string $key Recovery Mode key created by {@see generate_and_store_recovery_mode_key()}. 100 103 * @return string Recovery mode begin URL. 101 104 */ 102 private function get_recovery_mode_begin_url( $ key ) {105 private function get_recovery_mode_begin_url( $token, $key ) { 103 106 104 107 $url = add_query_arg( 105 108 array( 106 'action' => self::LOGIN_ACTION_ENTER, 107 'rm_key' => $key, 109 'action' => self::LOGIN_ACTION_ENTER, 110 'rm_token' => $token, 111 'rm_key' => $key, 108 112 ), 109 113 wp_login_url() … … 115 119 * @since 5.2.0 116 120 * 117 * @param string $url 118 * @param string $key 121 * @param string $url The generated recovery mode begin URL. 122 * @param string $token The token used to identify the key. 123 * @param string $key The recovery mode key. 119 124 */ 120 return apply_filters( 'recovery_mode_begin_url', $url, $ key );125 return apply_filters( 'recovery_mode_begin_url', $url, $token, $key ); 121 126 } 122 127 }
Note: See TracChangeset
for help on using the changeset viewer.