Plugin Directory

Changeset 2949495


Ignore:
Timestamp:
08/08/2023 04:51:43 PM (2 years ago)
Author:
samglover
Message:

1.7.8

Location:
client-power-tools
Files:
110 added
6 edited

Legend:

Unmodified
Added
Removed
  • client-power-tools/trunk/assets/js/cpt-frontend.js

    r2811319 r2949495  
    6666
    6767const messages = document.getElementById('cpt-login-messages');
     68const nonceField = document.getElementById('cpt-login-nonce');
    6869const emailRow = document.getElementById('cpt-login-email');
    6970const emailField = document.getElementById('cpt-login-email-field');
     
    113114    url: cpt_vars.ajaxURL,
    114115    data: {
    115       _ajax_nonce: cpt_vars.nonce,
     116      _ajax_nonce: nonceField.value,
    116117      action: 'send_login_code',
    117118      email: emailField.value
     
    147148    url: cpt_vars.ajaxURL,
    148149    data: {
    149       _ajax_nonce: cpt_vars.nonce,
     150      _ajax_nonce: nonceField.value,
    150151      action: 'check_login_code',
    151152      email: emailField.value ? emailField.value : decodeURIComponent(params.get('user')),
     
    170171    url: cpt_vars.ajaxURL,
    171172    data: {
    172       _ajax_nonce: cpt_vars.nonce,
     173      _ajax_nonce: nonceField.value,
    173174      action: 'check_password',
    174175      email: emailField.value,
     
    177178    // beforeSend: function() {},
    178179    success: function(response) {
    179       // console.debug(response);
     180      console.debug(response);
    180181      displayMessages(response);
    181182      if (response.success) location.reload();
  • client-power-tools/trunk/changelog.txt

    r2947193 r2949495  
    33All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com).
    44
     5
     6### 1.7.8 - 2023-08-08
     7
     8#### Fixed
     9- The login form would sometimes fail under unusual conditions. Now it should happily log you in as expected, or else deliver error messages instead of just sitting there opaquely.
     10
     11
    512### 1.7.7 - 2023-08-03
    613
    7 ### Changed
     14#### Changed
    815- Renamed the primary dashboard page in the navigation tabs to "Home.'
    916- Moved the page title filter from /common/cpt-common.php to /frontend/cpt-frontend.php.
    1017
    11 ### Fixed
     18#### Fixed
    1219- The home page title would show as "Client Dashboard: Client Dashboard" which was dumb. Fixed.
    1320
     
    1522### 1.7.6 - 2023-07-27
    1623
    17 ### Added
     24#### Added
    1825- cpt_is_additional_page()
    1926- cpt_add_nav_to_addl_pages()
    2027
    21 ### Changed
     28#### Changed
    2229- No longer shows projects in the client list table if the Projects module is not active.
    2330- Consolidated Knowledge Base breadcrumbs logic in the cpt_kb_breadcrumbs() function.
     
    2633- Page titles within the client dashboard now include both the dashboard title and the name of the page for all pages.
    2734
    28 ### Removed
     35#### Removed
    2936- Removed the confusingly named cpt_is_cpt() function from /frontend/frontend.php. cpt_is_client_dashboard() does the same job. (cpt_is_cpt() still works; it just returns the output of cpt_is_client_dashboard()).
    3037
  • client-power-tools/trunk/client-power-tools.php

    r2947193 r2949495  
    55 * Plugin URI: https://clientpowertools.com
    66 * Description: Client Power Tools is an easy-to-use client dashboard, project management, and communication portal built for designers, developers, consultants, lawyers, and other professionals.
    7  * Version: 1.7.7
     7 * Version: 1.7.8
    88 * Author: Sam Glover
    99 * Author URI: https://samglover.net
     
    2020 * Constants
    2121 */
    22 define('CLIENT_POWER_TOOLS_PLUGIN_VERSION', '1.7.7');
     22define('CLIENT_POWER_TOOLS_PLUGIN_VERSION', '1.7.8');
    2323define('CLIENT_POWER_TOOLS_DIR_PATH', plugin_dir_path(__FILE__));
    2424define('CLIENT_POWER_TOOLS_DIR_URL', plugin_dir_url(__FILE__));
     
    6161            'isCPT'     => Common\cpt_is_client_dashboard(),
    6262            'ajaxURL'   => admin_url('admin-ajax.php'),
    63             'nonce'     => wp_create_nonce('cpt-login-nonce'),
    6463        ]);
    6564        wp_enqueue_script('cpt-frontend');
  • client-power-tools/trunk/common/cpt-login.php

    r2909684 r2949495  
    33namespace Client_Power_Tools\Core\Common;
    44
    5 add_action('wp_ajax_nopriv_check_password', __NAMESPACE__ . '\check_password');
    6 function check_password() {
    7   if (!isset($_POST['_ajax_nonce']) || !wp_verify_nonce($_POST['_ajax_nonce'], 'cpt-login-nonce')) wp_send_json_error(['message' => __('Invalid nonce.', 'client-power-tools')]);
    8   if (!isset($_POST['email']) || strlen($_POST['email']) < 1) wp_send_json_error(['message' => __('Email address is missing.', 'client-power-tools')]);
    9   if (!isset($_POST['password']) || strlen($_POST['password']) < 1) wp_send_json_error(['message' => __('Password is missing.', 'client-power-tools')]);
    10 
    11   $user = get_user_by('email', sanitize_email($_POST['email']));
    12   $password = wp_check_password($_POST['password'], $user->data->user_pass, $user->ID);
    13   if (!$user || !$password) wp_send_json_error(['message' => __('Login failed.', 'client-power-tools')]);
    14 
    15   wp_set_current_user($user->ID);
    16     wp_set_auth_cookie($user->ID, true);
    17   wp_send_json_success(['message' => __('Logging you in …', 'client-power-tools')]);
    18 }
    19 
    20 
    215add_action('wp_ajax_nopriv_send_login_code', __NAMESPACE__ . '\send_login_code');
    226function send_login_code() {
    23   if (!isset($_POST['_ajax_nonce']) || !wp_verify_nonce($_POST['_ajax_nonce'], 'cpt-login-nonce')) wp_send_json_error(['message' => __('Invalid nonce.', 'client-power-tools')]);
     7  if (!isset($_POST['_ajax_nonce']) || !wp_verify_nonce($_POST['_ajax_nonce'], 'cpt-login')) wp_send_json_error(['message' => __('Invalid nonce.', 'client-power-tools')]);
    248  if (!isset($_POST['email']) || strlen($_POST['email']) < 1) wp_send_json_error(['message' => __('Email address is missing.', 'client-power-tools')]);
    259  if (!is_email(sanitize_email($_POST['email']))) wp_send_json_error(['message' => __('Please enter a valid email address.', 'client-power-tools')]);
     
    6347add_action('wp_ajax_nopriv_check_login_code', __NAMESPACE__ . '\check_login_code');
    6448function check_login_code() {
    65   if (!isset($_POST['_ajax_nonce']) || !wp_verify_nonce($_POST['_ajax_nonce'], 'cpt-login-nonce')) wp_send_json_error(['message' => __('Invalid nonce.', 'client-power-tools')]);
     49  if (!isset($_POST['_ajax_nonce']) || !wp_verify_nonce($_POST['_ajax_nonce'], 'cpt-login')) wp_send_json_error(['message' => __('Invalid nonce.', 'client-power-tools')]);
    6650  if (!isset($_POST['email']) || strlen($_POST['email']) < 1) wp_send_json_error(['message' => __('Email address is missing.', 'client-power-tools')]);
    6751
     
    9478  wp_send_json_success(['message' => __('Logging you in …', 'client-power-tools')]);
    9579}
     80
     81
     82add_action('wp_ajax_nopriv_check_password', __NAMESPACE__ . '\check_password');
     83function check_password() {
     84  if (!isset($_POST['_ajax_nonce']) || !wp_verify_nonce($_POST['_ajax_nonce'], 'cpt-login')) wp_send_json_error(['message' => __('Invalid nonce.', 'client-power-tools')]);
     85  if (!isset($_POST['email']) || strlen($_POST['email']) < 1) wp_send_json_error(['message' => __('Email address is missing.', 'client-power-tools')]);
     86  if (!isset($_POST['password']) || strlen($_POST['password']) < 1) wp_send_json_error(['message' => __('Password is missing.', 'client-power-tools')]);
     87
     88  $user = is_email(sanitize_email($_POST['email'])) ? get_user_by('email', sanitize_email($_POST['email'])) : false;
     89  $password = wp_check_password($_POST['password'], $user->data->user_pass, $user->ID);
     90  if (!$user || !$password) wp_send_json_error(['message' => __('Login failed.', 'client-power-tools')]);
     91
     92  wp_set_current_user($user->ID);
     93    wp_set_auth_cookie($user->ID, true);
     94  wp_send_json_success(['message' => __('Logging you in …', 'client-power-tools')]);
     95}
  • client-power-tools/trunk/frontend/cpt-frontend.php

    r2947193 r2949495  
    3232          <div id="cpt-login-messages"></div>
    3333          <form id="cpt-login-form" name="cpt-login-form" action="<?php echo get_permalink(); ?>" method="post">
     34            <?php wp_nonce_field('cpt-login', 'cpt-login-nonce'); ?>
    3435            <p id="cpt-login-email">
    3536              <label for="cpt-login-email-field">Email Address</label>
  • client-power-tools/trunk/readme.txt

    r2947193 r2949495  
    116116== Changelog ==
    117117
     118### 1.7.8 - 2023-08-08
     119
     120#### Fixed
     121- The login form would sometimes fail under unusual conditions. Now it should happily log you in as expected, or else deliver error messages instead of just sitting there opaquely.
     122
     123
    118124### 1.7.7 - 2023-08-03
    119125
    120 ### Changed
     126#### Changed
    121127- Renamed the primary dashboard page in the navigation tabs to "Home.'
    122128
    123 ### Fixed
     129#### Fixed
    124130- The home page title would show as "Client Dashboard: Client Dashboard" which was dumb. Fixed.
    125131- Moved the page title filter from /common/cpt-common.php to /frontend/cpt-frontend.php.
     
    127133### 1.7.6 - 2023-07-27
    128134
    129 ### Added
     135#### Added
    130136- cpt_is_additional_page()
    131137- cpt_add_nav_to_addl_pages()
    132138
    133 ### Changed
     139#### Changed
    134140- No longer shows projects in the client list table if the Projects module is not active.
    135141- Consolidated Knowledge Base breadcrumbs logic in the cpt_kb_breadcrumbs() function.
     
    138144- Page titles within the client dashboard now include both the dashboard title and the name of the page for all pages.
    139145
    140 ### Removed
     146#### Removed
    141147- Removed the confusingly named cpt_is_cpt() function from /frontend/frontend.php. cpt_is_client_dashboard() does the same job. (cpt_is_cpt() still works; it just returns the output of cpt_is_client_dashboard()).
    142148
Note: See TracChangeset for help on using the changeset viewer.