original_string: public function forgot()
      {
          if (!empty($this->request->data['username'])) {
              $this->loadModel('User.Users');
              $user = $this->Users
                  ->find()
                  ->where(['Users.username' => $this->request->data['username']])
                  ->orWhere(['Users.email' => $this->request->data['username']])
                  ->first();
  
              if ($user) {
                  $emailSent = NotificationManager::passwordRequest($user)->send();
                  if ($emailSent) {
                      $this->Flash->success(__d('user', 'Further instructions have been sent to your e-mail address.'));
                  } else {
                      $this->Flash->warning(__d('user', 'Instructions could not been sent to your e-mail address, please try again later.'));
                  }
              } else {
                  $this->Flash->danger(__d('user', 'Sorry, "{0}" is not recognized as a user name or an e-mail address.', $this->request->data['username']));
              }
          }
  
          $this->title(__d('user', 'Password Recovery'));
      }
code: public function forgot()
      {
          if (!empty($this->request->data['username'])) {
              $this->loadModel('User.Users');
              $user = $this->Users
                  ->find()
                  ->where(['Users.username' => $this->request->data['username']])
                  ->orWhere(['Users.email' => $this->request->data['username']])
                  ->first();
  
              if ($user) {
                  $emailSent = NotificationManager::passwordRequest($user)->send();
                  if ($emailSent) {
                      $this->Flash->success(__d('user', 'Further instructions have been sent to your e-mail address.'));
                  } else {
                      $this->Flash->warning(__d('user', 'Instructions could not been sent to your e-mail address, please try again later.'));
                  }
              } else {
                  $this->Flash->danger(__d('user', 'Sorry, "{0}" is not recognized as a user name or an e-mail address.', $this->request->data['username']));
              }
          }
  
          $this->title(__d('user', 'Password Recovery'));
      }
code_tokens: public function forgot ( ) { if ( ! empty ( $ this -> request -> data [ 'username' ] ) ) { $ this -> loadModel ( 'User.Users' ) ; $ user = $ this -> Users -> find ( ) -> where ( [ 'Users.username' => $ this -> request -> data [ 'username' ] ] ) -> orWhere ( [ 'Users.email' => $ this -> request -> data [ 'username' ] ] ) -> first ( ) ; if ( $ user ) { $ emailSent = NotificationManager :: passwordRequest ( $ user ) -> send ( ) ; if ( $ emailSent ) { $ this -> Flash -> success ( __d ( 'user' , 'Further instructions have been sent to your e-mail address.' ) ) ; } else { $ this -> Flash -> warning ( __d ( 'user' , 'Instructions could not been sent to your e-mail address, please try again later.' ) ) ; } } else { $ this -> Flash -> danger ( __d ( 'user' , 'Sorry, "{0}" is not recognized as a user name or an e-mail address.' , $ this -> request -> data [ 'username' ] ) ) ; } } $ this -> title ( __d ( 'user' , 'Password Recovery' ) ) ; }
docstring: Starts the password recovery process.
  
  @return void
docstring_tokens: Starts the password recovery process .