| @@ -14,16 +14,8 @@ | ||
| 14 | 14 | class Controller_E2pdf_Integrations extends Helper_E2pdf_View { |
| 15 | 15 | |
| 16 | 16 | // url: admin.php?page=e2pdf-integrations |
| 17 | 17 | public function index_action() { |
| 18 | - if ($this->post->get('_wpnonce')) { | |
| 19 | - if (wp_verify_nonce($this->post->get('_wpnonce'), 'e2pdf_integrations')) { | |
| 20 | - /* translators: %s: Action */ | |
| 21 | - $this->add_notification('update', sprintf(__('Success: %s', 'e2pdf'), __('Settings Saved', 'e2pdf'))); | |
| 22 | - } else { | |
| 23 | - wp_die($this->message('wp_verify_nonce_error')); | |
| 24 | - } | |
| 25 | - } | |
| 26 | 18 | $this->view('options', Model_E2pdf_Options::get_options(false, ['zapier_group'])); |
| 27 | 19 | $this->view('groups', $this->get_groups()); |
| 28 | 20 | } |
| 29 | 21 | |
| @@ -43,14 +35,14 @@ | ||
| 43 | 35 | update_option('e2pdf_adobesign_refresh_token', false); |
| 44 | 36 | set_transient('e2pdf_adobesign_access_token', false); |
| 45 | 37 | Model_E2pdf_Options::update_options('adobesign_group', $this->post->get()); |
| 46 | 38 | if (!get_option('e2pdf_adobesign_client_id', '') || !get_option('e2pdf_adobesign_client_secret', '') || !get_option('e2pdf_adobesign_region', '')) { |
| 47 | - $this->add_notification('update', __('Not Authorized', 'e2pdf')); | |
| 48 | 39 | $this->redirect( |
| 49 | 40 | $this->helper->get_url( |
| 50 | 41 | [ |
| 51 | 42 | 'page' => 'e2pdf-integrations', |
| 52 | 43 | 'action' => 'adobesign', |
| 44 | + 'notification' => $this->add_notification('update', __('Not Authorized', 'e2pdf')), | |
| 53 | 45 | ] |
| 54 | 46 | ) |
| 55 | 47 | ); |
| 56 | 48 | } else { |
| @@ -66,18 +58,14 @@ | ||
| 66 | 58 | } elseif ($this->get->get('code') && $this->get->get('_wpnonce') && get_option('e2pdf_adobesign_client_id', '') && get_option('e2pdf_adobesign_client_secret', '')) { |
| 67 | 59 | if (wp_verify_nonce($this->get->get('_wpnonce'), 'e2pdf_adobe')) { |
| 68 | 60 | update_option('e2pdf_adobesign_code', sanitize_text_field(wp_unslash($this->get->get('code')))); |
| 69 | 61 | $request = (new Model_E2pdf_AdobeSign())->get_token(); |
| 70 | - if (isset($request['error'])) { | |
| 71 | - $this->add_notification('error', $request['error']); | |
| 72 | - } else { | |
| 73 | - $this->add_notification('update', __('App Authorized', 'e2pdf')); | |
| 74 | - } | |
| 75 | 62 | $this->redirect( |
| 76 | 63 | $this->helper->get_url( |
| 77 | 64 | [ |
| 78 | 65 | 'page' => 'e2pdf-integrations', |
| 79 | 66 | 'action' => 'adobesign', |
| 67 | + 'notification' => isset($request['error']) ? $this->add_notification('error', $request['error']) : $this->add_notification('update', __('App Authorized', 'e2pdf')), | |
| 80 | 68 | ] |
| 81 | 69 | ) |
| 82 | 70 | ); |
| 83 | 71 | } else { |
| @@ -103,14 +91,14 @@ | ||
| 103 | 91 | update_option('e2pdf_gdrive_refresh_token', ''); |
| 104 | 92 | delete_transient('e2pdf_gdrive_access_token'); |
| 105 | 93 | Model_E2pdf_Options::update_options('gdrive_group', $this->post->get()); |
| 106 | 94 | if (!get_option('e2pdf_gdrive_client_id', '') || !get_option('e2pdf_gdrive_client_secret', '')) { |
| 107 | - $this->add_notification('update', __('Not Authorized', 'e2pdf')); | |
| 108 | 95 | $this->redirect( |
| 109 | 96 | $this->helper->get_url( |
| 110 | 97 | [ |
| 111 | 98 | 'page' => 'e2pdf-integrations', |
| 112 | 99 | 'action' => 'gdrive', |
| 100 | + 'notification' => $this->add_notification('update', __('Not Authorized', 'e2pdf')), | |
| 113 | 101 | ] |
| 114 | 102 | ) |
| 115 | 103 | ); |
| 116 | 104 | } else { |