| @@ -29,18 +29,18 @@ | ||
| 29 | 29 | <!-- Option 1: Email/Password Login --> |
| 30 | 30 | <div class="card" style="max-width: 600px; margin: 20px 0; padding: 20px; background: #fff; border: 1px solid #c3c4c7; box-shadow: 0 1px 1px rgba(0,0,0,.04);"> |
| 31 | 31 | <h3 style="margin-top: 0; display: flex; align-items: center; gap: 8px;"> |
| 32 | 32 | <span style="background: #2271b1; color: #fff; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 14px;">1</span> |
| 33 | - Login with Email & Password | |
| 33 | + Login with your onWebChat Email & Password | |
| 34 | 34 | </h3> |
| 35 | 35 | <p style="color: #646970; margin-bottom: 15px;"> |
| 36 | - Recommended — enables automatic WooCommerce sync connection. | |
| 36 | + Recommended: it also connects the product sync for your AI chatbot (Products & Orders tab). | |
| 37 | 37 | </p> |
| 38 | 38 | |
| 39 | 39 | <table class="form-table" style="margin: 0;"> |
| 40 | 40 | <tr> |
| 41 | 41 | <th scope="row" style="width: 100px; padding: 10px 10px 10px 0;"> |
| 42 | - <label for="onWebChatUser">Email</label> | |
| 42 | + <label for="onWebChatUser">onWebChat Email (username)</label> | |
| 43 | 43 | </th> |
| 44 | 44 | <td style="padding: 10px 0;"> |
| 45 | 45 | <input type="email" |
| 46 | 46 | id="onWebChatUser" |
| @@ -45,15 +45,15 @@ | ||
| 45 | 45 | <input type="email" |
| 46 | 46 | id="onWebChatUser" |
| 47 | 47 | name="onWebChatUser" |
| 48 | 48 | class="regular-text" |
| 49 | - placeholder="your@email.com" | |
| 49 | + placeholder="Your registered email" | |
| 50 | 50 | value="<?php echo esc_attr(get_option('onwebchat_plugin_option_user')); ?>"> |
| 51 | 51 | </td> |
| 52 | 52 | </tr> |
| 53 | 53 | <tr> |
| 54 | 54 | <th scope="row" style="width: 100px; padding: 10px 10px 10px 0;"> |
| 55 | - <label for="onWebChatPass">Password</label> | |
| 55 | + <label for="onWebChatPass">onWebChat Password</label> | |
| 56 | 56 | </th> |
| 57 | 57 | <td style="padding: 10px 0;"> |
| 58 | 58 | <input type="password" |
| 59 | 59 | id="onWebChatPass" |
| @@ -58,9 +58,9 @@ | ||
| 58 | 58 | <input type="password" |
| 59 | 59 | id="onWebChatPass" |
| 60 | 60 | name="onWebChatPass" |
| 61 | 61 | class="regular-text" |
| 62 | - placeholder="Your onWebChat password"> | |
| 62 | + placeholder="Your account password"> | |
| 63 | 63 | </td> |
| 64 | 64 | </tr> |
| 65 | 65 | </table> |
| 66 | 66 | </div> |
| @@ -93,9 +93,9 @@ | ||
| 93 | 93 | name="chatId" |
| 94 | 94 | class="regular-text" |
| 95 | 95 | placeholder="e.g. 3a02c87b60726a4663b25463a424a248" |
| 96 | 96 | value="<?php echo esc_attr($chatId); ?>"> |
| 97 | - <p class="description">Found in your onWebChat Dashboard → Settings → Installation</p> | |
| 97 | + <p class="description">Found in your onWebChat Dashboard → Settings -> Widget → Installation</p> | |
| 98 | 98 | </td> |
| 99 | 99 | </tr> |
| 100 | 100 | </table> |
| 101 | 101 | </div> |
| @@ -167,11 +167,14 @@ | ||
| 167 | 167 | if (!isset($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'on_web_chat_nonce')) { |
| 168 | 168 | wp_die('Sorry, your nonce did not verify.'); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - $userName = isset($_POST["onWebChatUser"]) ? sanitize_text_field($_POST["onWebChatUser"]) : ''; | |
| 172 | - $userPass = isset($_POST["onWebChatPass"]) ? sanitize_text_field($_POST["onWebChatPass"]) : ''; | |
| 173 | - $chatId = isset($_POST["chatId"]) ? sanitize_text_field($_POST["chatId"]) : ''; | |
| 171 | + // Same rule as the WooCommerce tab: the password is only forwarded to onWebChat, so it | |
| 172 | + // must be un-slashed and NOT sanitized, otherwise sanitize_text_field() silently strips | |
| 173 | + // characters (spaces, %xx sequences, "<") and the correct password is refused. | |
| 174 | + $userName = isset($_POST["onWebChatUser"]) ? sanitize_text_field(wp_unslash($_POST["onWebChatUser"])) : ''; | |
| 175 | + $userPass = isset($_POST["onWebChatPass"]) ? (string) wp_unslash($_POST["onWebChatPass"]) : ''; | |
| 176 | + $chatId = isset($_POST["chatId"]) ? sanitize_text_field(wp_unslash($_POST["chatId"])) : ''; | |
| 174 | 177 | |
| 175 | 178 | if (isChatIdValid($chatId)) { |
| 176 | 179 | // Direct Chat ID provided |
| 177 | 180 | $my_options = get_option('onwebchat_plugin_option'); |