accountSetup.php
1 year ago
adminView.php
11 months ago
appConfig.php
7 months ago
feedbackForm.php
1 year ago
integrations.php
1 year ago
powerBI.php
7 months ago
powerBIsettings.php
7 months ago
support_form.php
1 year ago
accountSetup.php
311 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Handles Account Setup View |
| 4 | * |
| 5 | * @package embed-power-bi-reports\View |
| 6 | */ |
| 7 | |
| 8 | namespace MoEmbedPowerBI\View; |
| 9 | |
| 10 | use MoEmbedPowerBI\Wrappers\wpWrapper; |
| 11 | |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Class for Account Setup View tab. |
| 18 | */ |
| 19 | class accountSetup { |
| 20 | |
| 21 | /** |
| 22 | * Holds the instance of AccountSetup class. |
| 23 | * |
| 24 | * @var AccountSetup |
| 25 | */ |
| 26 | private static $instance; |
| 27 | |
| 28 | /** |
| 29 | * Object instance(AccountSetup) getter method. |
| 30 | * |
| 31 | * @return AccountSetup |
| 32 | */ |
| 33 | public static function get_view() { |
| 34 | if ( ! isset( self::$instance ) ) { |
| 35 | $class = __CLASS__; |
| 36 | self::$instance = new $class(); |
| 37 | } |
| 38 | return self::$instance; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Function to diaplay the tab details. |
| 43 | * |
| 44 | * @return void |
| 45 | */ |
| 46 | public function mo_epbr_display__tab_details() { |
| 47 | $option = wpWrapper::mo_epbr_is_customer_registered(); |
| 48 | if ( $option ) { |
| 49 | $this->mo_api_display_account_information(); |
| 50 | } elseif ( 'Login User' === get_option( 'mo_epbr_registration_status' ) ) { |
| 51 | $this->mo_api_final_view_login(); |
| 52 | } else { |
| 53 | $this->mo_api_final_view_registration(); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Function to display the login page. |
| 59 | * |
| 60 | * @return void |
| 61 | */ |
| 62 | private function mo_api_display__show_login_page() { |
| 63 | ?> |
| 64 | <div class="mo-ms-tab-content" style="width:77rem; "> |
| 65 | <!-- <h1 >Account Setup</h1> --> |
| 66 | <div style="width: 92%"> |
| 67 | <div class="mo-ms-tab-content-left-border" > |
| 68 | <form class="mo_msgraph_ajax_submit_form" id="mo_api_account_form" method="post"> |
| 69 | <input type="hidden" name="option" value="mo_api_account_login_setup_option"> |
| 70 | <input type="hidden" name="mo_epbr_tab" value="account_setup_tab"> |
| 71 | <?php wp_nonce_field( 'mo_api_account_login_setup_option' ); ?> |
| 72 | <div class="mo-ms-tab-content-tile"> |
| 73 | <div class="mo-ms-tab-content-tile-content"> |
| 74 | <?php $this->mo_api_display_why_login(); ?> |
| 75 | <div> |
| 76 | <table class="mo-ms-tab-content-app-config-table"> |
| 77 | <colgroup> |
| 78 | <col span="1" style="width: 10%;"> |
| 79 | <col span="2" style="width: 50%;"> |
| 80 | </colgroup> |
| 81 | <tr> |
| 82 | <td><span>Email<sup style="color:red">*</sup></span></td> |
| 83 | <td> |
| 84 | <input type="email" required placeholder="person@example.com" name="account_email" value='' style="width:100%;"> |
| 85 | </td> |
| 86 | </tr> |
| 87 | <tr> |
| 88 | <td><span>Password<sup style="color:red">*</sup></span></td> |
| 89 | <td><input type="password" required placeholder="Enter your password" name="account_pwd" style="width: 100%" |
| 90 | minlength="6" pattern="^[(\w)*(!@#.$%^&*-_)*]+$" |
| 91 | title="Minimum 6 characters should be present. Maximum 15 characters should be present. Only following symbols (!@#.$%^&*-_) should be present" |
| 92 | > |
| 93 | </td> |
| 94 | </tr> |
| 95 | |
| 96 | <tr><td></td></tr> |
| 97 | |
| 98 | <tr><td></td></tr> |
| 99 | |
| 100 | <tr> |
| 101 | <td><span></span></td> |
| 102 | <td> |
| 103 | <input type="submit" class="button button-primary button-large" value="Login" style="float:left;" href="?page=mo_epbr&tab=account_setup_tab"> |
| 104 | <input type="button" class="button button-primary button-large" style="margin-left:20px;" value="Register " onclick="clickRegisHandler()"/> |
| 105 | </td> |
| 106 | |
| 107 | </tr> |
| 108 | </table> |
| 109 | |
| 110 | |
| 111 | <script> |
| 112 | function clickRegisHandler(){ |
| 113 | document.getElementById('check_regis').submit(); |
| 114 | } |
| 115 | </script> |
| 116 | </div> |
| 117 | </div> |
| 118 | </div> |
| 119 | </form> |
| 120 | |
| 121 | <form id="check_regis" method="post"> |
| 122 | <input type="hidden" name="option" value="mo_api_is_regis"/> |
| 123 | <input type="hidden" name="mo_epbr_tab" value="account_setup_tab"> |
| 124 | <?php wp_nonce_field( 'mo_api_is_regis' ); ?> |
| 125 | </form> |
| 126 | </div> |
| 127 | </div> |
| 128 | </div> |
| 129 | <?php |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * Function to display the account information. |
| 134 | * |
| 135 | * @return void |
| 136 | */ |
| 137 | private function mo_api_display_account_information() { |
| 138 | ?> |
| 139 | <div class="mo-ms-tab-content" style="width: 77rem"> |
| 140 | <!-- <h1>Account Setup</h1> --> |
| 141 | <div style="width: 92%"> |
| 142 | <div class="mo-ms-tab-content-left-border"> |
| 143 | <form class="mo_msgraph_ajax_submit_form" id="mo_api_remove_account_form" method="post"> |
| 144 | <input type="hidden" name="option" value="mo_api_remove_account_option"> |
| 145 | <input type="hidden" name="mo_epbr_tab" value="account_setup_tab"> |
| 146 | <?php wp_nonce_field( 'mo_api_remove_account_option' ); ?> |
| 147 | <div class="mo-ms-tab-content-tile"> |
| 148 | <div class="mo-ms-tab-content-tile-content"> |
| 149 | <span style="font-size: 18px;font-weight: 400;">Your Profile</span> |
| 150 | </br></br> |
| 151 | <span>Thank you for registering with <b>miniOrange</b>.</span> |
| 152 | </br> |
| 153 | </br> |
| 154 | <div > |
| 155 | <table border="1" style="background-color:#FFFFFF; border:1px solid #CCCCCC; border-collapse: collapse; padding:0px 0px 0px 10px; margin:2px; width:85%"> |
| 156 | <tr> |
| 157 | <td style="width:45%; padding: 10px;">miniOrange Account Email</td> |
| 158 | <td style="width:55%; padding: 10px;"><?php echo esc_attr( get_option( 'mo_epbr_admin_email' ) ); ?></td> |
| 159 | </tr> |
| 160 | <tr> |
| 161 | <td style="width:45%; padding: 10px;">Customer ID</td> |
| 162 | <td style="width:55%; padding: 10px;"><?php echo esc_attr( get_option( 'mo_epbr_admin_customer_key' ) ); ?></td> |
| 163 | </tr> |
| 164 | </table> |
| 165 | </br> |
| 166 | <input type="submit" class="button button-primary button-large" value="Remove Account"> |
| 167 | </div> |
| 168 | </div> |
| 169 | </div> |
| 170 | </form> |
| 171 | </div> |
| 172 | </div> |
| 173 | </div> |
| 174 | <?php |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * Function to display the content of why the user should login. |
| 179 | * |
| 180 | * @return void |
| 181 | */ |
| 182 | private function mo_api_display_why_login() { |
| 183 | ?> |
| 184 | <div style="margin-bottom: 1%" > |
| 185 | <h3 >Why should I login?</h3> |
| 186 | <hr> |
| 187 | <div style="background: aliceblue; padding: 10px 10px 10px 10px; border-radius: 10px;"> |
| 188 | <p style="text-align: justify ;"> |
| 189 | It seems you already have an account with miniOrange. Please enter your miniOrange email and password. |
| 190 | </p> |
| 191 | <div><a style="text-decoration:none;" href="https://login.xecurify.com/moas/idp/resetpassword" target="_blank">Click here if you forgot your password?</a></div> |
| 192 | </div> |
| 193 | </div> |
| 194 | <?php |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * Function to display the final view of login. |
| 199 | * |
| 200 | * @return void |
| 201 | */ |
| 202 | private function mo_api_final_view_login() { |
| 203 | $this->mo_api_display__show_login_page(); |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * Function to show registration page. |
| 208 | * |
| 209 | * @return void |
| 210 | */ |
| 211 | private function mo_api_display__show_registration_page() { |
| 212 | ?> |
| 213 | <div class="mo-ms-tab-content" style="width: 77rem"> |
| 214 | <!-- <h1 >Account Setup</h1> --> |
| 215 | <div style="width: 92%"> |
| 216 | <div class="mo-ms-tab-content-left-border"> |
| 217 | <form class="mo_msgraph_ajax_submit_form" id="mo_api_account_form" method="post"> |
| 218 | <input type="hidden" name="option" value="mo_api_account_registration_setup_option"> |
| 219 | <input type="hidden" name="mo_epbr_tab" value="account_setup_tab"> |
| 220 | <?php wp_nonce_field( 'mo_api_account_registration_setup_option' ); ?> |
| 221 | <div class="mo-ms-tab-content-tile"> |
| 222 | <div class="mo-ms-tab-content-tile-content"> |
| 223 | <?php $this->mo_api_display_why_registration(); ?> |
| 224 | <div > |
| 225 | <table class="mo-ms-tab-content-app-config-table"> |
| 226 | <colgroup> |
| 227 | <col span="1" style="width: 15%;"> |
| 228 | <col span="2" style="width: 50%;"> |
| 229 | </colgroup> |
| 230 | <tr> |
| 231 | <td><span>Email<sup style="color:red">*</sup></span></td> |
| 232 | <td> |
| 233 | <input type="email" style="width: 100%;" required placeholder="person@example.com" name="account_email" value=''> |
| 234 | </td> |
| 235 | </tr> |
| 236 | <tr> |
| 237 | <td><span>Password<sup style="color:red">*</sup></span></td> |
| 238 | <td><input type="password" required placeholder="Enter your password" name="account_pwd" style="width: 100%" |
| 239 | minlength="6" pattern="^[(\w)*(!@#.$%^&*-_)*]+$" |
| 240 | title="Minimum 6 characters should be present. Maximum 15 characters should be present. Only following symbols (!@#.$%^&*-_) should be present" |
| 241 | > |
| 242 | </td> |
| 243 | </tr> |
| 244 | <tr> |
| 245 | <td><span >Confirm Password<sup style="color:red">*</sup></span></td> |
| 246 | <td><input type="password" required placeholder="Confirm your password" name="confirm_account_pwd" style="width: 100%" minlength="6" pattern="^[(\w)*(!@#.$%^&*-_)*]+$" title="Minimum 6 characters should be present. Maximum 15 characters should be present. Only following symbols (!@#.$%^&*-_) should be present"> |
| 247 | </td> |
| 248 | </tr> |
| 249 | <tr><td></td></tr> |
| 250 | |
| 251 | <tr><td></td></tr> |
| 252 | |
| 253 | <tr> |
| 254 | <td></td> |
| 255 | <td> |
| 256 | <input type="submit" class="button button-primary button-large" value="Register"> |
| 257 | <input type="button" class="button button-primary button-large" value="Login with existing account" onclick="clickHandler()" style="margin-left:20px;"/> |
| 258 | </td> |
| 259 | </tr> |
| 260 | </table> |
| 261 | <script> |
| 262 | function clickHandler(){ |
| 263 | document.getElementById('check_login').submit(); |
| 264 | } |
| 265 | </script> |
| 266 | </div> |
| 267 | </div> |
| 268 | </div> |
| 269 | </form> |
| 270 | |
| 271 | <form id="check_login" method="post"> |
| 272 | <?php wp_nonce_field( 'mo_api_is_login' ); ?> |
| 273 | <input type="hidden" name="option" value="mo_api_is_login"/> |
| 274 | <input type="hidden" name="mo_epbr_tab" value="account_setup_tab"> |
| 275 | </form> |
| 276 | </div> |
| 277 | </div> |
| 278 | </div> |
| 279 | |
| 280 | |
| 281 | <?php |
| 282 | } |
| 283 | |
| 284 | /** |
| 285 | * Function to display the content why user should register. |
| 286 | * |
| 287 | * @return void |
| 288 | */ |
| 289 | private function mo_api_display_why_registration() { |
| 290 | ?> |
| 291 | <div > |
| 292 | <h3 >Why should I register?</h3> |
| 293 | <hr> |
| 294 | <div style="background: aliceblue; padding: 10px 10px 10px 10px; border-radius: 10px;"> |
| 295 | <p style="text-align: justify ;"> |
| 296 | You should register so that in case you need help, we can help you with step-by-step instructions. We support integrations with many WordPress plugins, you can also reach out in case you want a new integration or need help with setting up the plugin. <b>You will also need a miniOrange account to upgrade to the premium version of the plugins.</b> We do not store any information except the email that you will use to register with us. |
| 297 | </p></div> |
| 298 | </div> |
| 299 | <?php |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Function to display the registration view. |
| 304 | * |
| 305 | * @return void |
| 306 | */ |
| 307 | private function mo_api_final_view_registration() { |
| 308 | $this->mo_api_display__show_registration_page(); |
| 309 | } |
| 310 | } |
| 311 |