/**
  * Reset API key
  *
  * @param void
  * @return null
  */
 function api_reset_key()
 {
     if ($this->active_user->isNew()) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->active_user->canEdit($this->logged_user)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     if ($this->request->isSubmitted()) {
         $this->active_user->setToken(make_string(40));
         $save = $this->active_user->save();
         if ($save && !is_error($save)) {
             flash_success('API key updated');
         } else {
             flash_error('Failed to update API key. Try again in a few minutes');
         }
         // if
         $this->redirectToUrl($this->active_user->getApiSettingsUrl());
     } else {
         $this->httpError(HTTP_ERR_BAD_REQUEST);
     }
     // if
 }