Plugin Directory

Changeset 3041265


Ignore:
Timestamp:
02/26/2024 12:37:55 PM (22 months ago)
Author:
madalin.ungureanu
Message:

realeasing version 1.1.3

Location:
passwordless-login
Files:
11 added
3 edited

Legend:

Unmodified
Added
Removed
  • passwordless-login/trunk/inc/wpa.class.notices.php

    r2190567 r3041265  
    4949
    5050    function dismiss_notification() {
     51
     52        if( empty( $_GET['_wpnonce'] ) || !wp_verify_nonce( sanitize_text_field( $_GET['_wpnonce'] ), 'wpa_notice_dismiss' ) )
     53            return;
     54
    5155        global $current_user;
    5256
  • passwordless-login/trunk/passwordless_login.php

    r2761240 r3041265  
    22/**
    33* Plugin Name: Passwordless Login
    4 * Plugin URI: http://www.cozmoslabs.com
     4* Plugin URI: https://www.cozmoslabs.com
    55* Description: Shortcode based login form. Enter an email/username and get link via email that will automatically log you in.
    6 * Version: 1.1.2
     6* Version: 1.1.3
    77* Author: Cozmoslabs, sareiodata
    8 * Author URI: http:/www.cozmoslabs.com
     8* Author URI: https://www.cozmoslabs.com
    99* License: GPL2
    1010* Text Domain: passwordless-login
     
    3535 *
    3636 */
    37 define( 'PASSWORDLESS_LOGIN_VERSION', '1.1.2' );
     37define( 'PASSWORDLESS_LOGIN_VERSION', '1.1.3' );
    3838define( 'WPA_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) );
    3939define( 'WPA_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
     
    146146function wpa_front_end_login(){
    147147    ob_start();
    148     $account = ( isset( $_POST['user_email_username']) ) ? $account = sanitize_text_field( $_POST['user_email_username'] ) : false;
    149     $error_token = ( isset( $_GET['wpa_error_token']) ) ? $error_token = sanitize_key( $_GET['wpa_error_token'] ) : false;
     148    $account        = ( isset( $_POST['user_email_username']) ) ? $account = sanitize_text_field( $_POST['user_email_username'] ) : false;
     149    $error_token    = ( isset( $_GET['wpa_error_token']) ) ? $error_token = sanitize_key( $_GET['wpa_error_token'] ) : false;
    150150    $adminapp_error = ( isset( $_GET['wpa_adminapp_error']) ) ? sanitize_key( $_GET['wpa_adminapp_error'] ) : false;
    151151
     
    156156    } elseif ( is_user_logged_in() ) {
    157157        $current_user = wp_get_current_user();
    158         echo '<p class="wpa-box wpa-alert">'.apply_filters('wpa_success_login_msg', sprintf(__( 'You are currently logged in as %1$s. %2$s', 'passwordless-login' ), '<a href="'.$authorPostsUrl = get_author_posts_url( $current_user->ID ).'" title="'.$current_user->display_name.'">'.$current_user->display_name.'</a>', '<a href="'.wp_logout_url( $redirectTo = wpa_curpageurl() ).'" title="'.__( 'Log out of this account', 'passwordless-login' ).'">'. __( 'Log out', 'passwordless-login').' &raquo;</a>' ) ) . '</p><!-- .alert-->';
     158        echo '<p class="wpa-box wpa-alert">'.apply_filters('wpa_success_login_msg', sprintf(__( 'You are currently logged in as %1$s. %2$s', 'passwordless-login' ), '<a href="'.esc_url( get_author_posts_url( $current_user->ID ) ).'" title="'.esc_attr( $current_user->display_name ).'">'.esc_html( $current_user->display_name ).'</a>', '<a href="'.esc_url( wp_logout_url( $redirectTo = wpa_curpageurl() ) ).'" title="'.__( 'Log out of this account', 'passwordless-login' ).'">'. __( 'Log out', 'passwordless-login').' &raquo;</a>' ) ) . '</p><!-- .alert-->';
    159159    } else {
    160160        if ( is_wp_error($sent_link) ){
    161             echo '<p class="wpa-box wpa-error">' . apply_filters( 'wpa_error', $sent_link->get_error_message() ) . '</p>';
     161            echo '<p class="wpa-box wpa-error">' . esc_html( apply_filters( 'wpa_error', $sent_link->get_error_message() ) ) . '</p>';
    162162        }
    163163        if( $error_token ) {
     
    186186    <form name="wpaloginform" id="wpaloginform" action="" method="post">
    187187        <p>
    188             <label for="user_email_username"><?php echo( apply_filters('wpa_change_form_label', $label)) ; ?></label>
     188            <label for="user_email_username"><?php echo esc_html( apply_filters('wpa_change_form_label', $label ) ); ?></label>
    189189            <input type="text" name="user_email_username" id="user_email_username" class="input" value="<?php echo esc_attr( $account ); ?>" size="25" />
    190190            <input type="submit" name="wpa-submit" id="wpa-submit" class="button-primary" value="<?php esc_attr_e('Log In', 'passwordless-login'); ?>" />
     
    233233    }
    234234
    235     return new WP_Error( 'invalid_account', __( 'The username or email you provided do not exist. Please try again.', 'passwordless-login' ) );
     235    return new WP_Error( 'invalid_account', __( 'The username or email you provided does not exist. Please try again.', 'passwordless-login' ) );
    236236}
    237237
     
    339339
    340340    if( isset( $_GET['token'] ) && isset( $_GET['uid'] ) && isset( $_GET['nonce'] ) ){
    341         $uid = sanitize_key( $_GET['uid'] );
    342         $token  = sanitize_key( $_REQUEST['token'] );
    343         $nonce  = sanitize_key( $_REQUEST['nonce'] );
    344 
    345         $hash_meta = get_user_meta( $uid, 'wpa_' . $uid, true);
     341        $uid   = sanitize_key( $_GET['uid'] );
     342        $token = sanitize_key( $_REQUEST['token'] );
     343        $nonce = sanitize_key( $_REQUEST['nonce'] );
     344
     345        $hash_meta            = get_user_meta( $uid, 'wpa_' . $uid, true);
    346346        $hash_meta_expiration = get_user_meta( $uid, 'wpa_' . $uid . '_expiration', true);
    347         $arr_params = array( 'uid', 'token', 'nonce' );
    348         $current_page_url = remove_query_arg( $arr_params, wpa_curpageurl() );
     347        $arr_params           = array( 'uid', 'token', 'nonce' );
     348        $current_page_url     = remove_query_arg( $arr_params, wpa_curpageurl() );
    349349
    350350        require_once( ABSPATH . 'wp-includes/class-phpass.php');
    351351        $wp_hasher = new PasswordHash(8, TRUE);
    352         $time = time();
     352        $time      = time();
    353353
    354354        $wppb_generalSettings = get_option('wppb_general_settings', 'not_found');//profile builder settings are required for admin approval compatibility
     
    369369            update_option( 'wpa_total_logins', $total_logins + 1);
    370370
    371             if (function_exists('wppb_custom_redirect_url')){
    372                 wp_redirect( apply_filters('wpa_after_login_redirect', wppb_custom_redirect_url('after_login', $current_page_url ) ) );
    373                 exit;
    374             }
    375 
    376             wp_redirect( apply_filters('wpa_after_login_redirect', $current_page_url ) );
     371            if ( function_exists('wppb_custom_redirect_url') ){
     372                $wppb_custom_redirects_url = wppb_custom_redirect_url( 'after_login', $current_page_url );
     373            }
     374
     375            $redirect_url = !empty( $wppb_custom_redirects_url ) ? $wppb_custom_redirects_url : $current_page_url;
     376
     377            wp_redirect( apply_filters('wpa_after_login_redirect', $redirect_url ) );
    377378            exit;
    378379        }
     380
    379381    }
    380382}
     
    421423    $req_uri = $_SERVER['REQUEST_URI'];
    422424
    423     $home_path = trim( parse_url( home_url(), PHP_URL_PATH ), '/' );
     425    $parsed_url = parse_url( home_url(), PHP_URL_PATH );
     426
     427    if( !empty( $parsed_url ) )
     428        $home_path = trim( $parsed_url, '/' );
     429    else
     430        $home_path = $parsed_url;
     431
     432    if( $home_path === null || $home_path === false )
     433        $home_path = '';
     434
    424435    $home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) );
    425436
     
    440451 * @return string
    441452 */
    442 
    443 include_once("inc/wpa.class.notices.php");
    444 $learn_more_notice = new WPA_Add_Notices(
    445     'wpa_learn_more',
    446     sprintf( __( '<p>Use [passwordless-login] shortcode in your pages or widgets. %1$sLearn more.%2$s  %3$sDismiss%4$s</p>', 'passwordless-login'), "<a href='users.php?page=passwordless-login&wpa_learn_more_dismiss_notification=0'>", "</a>", "<a href='". add_query_arg( 'wpa_learn_more_dismiss_notification', '0' ) ."' class='wpa-dismiss-notification' style='float:right;margin-left:20px;'> ", "</a>" ),
    447     'updated',  '', ''
    448 );
     453add_action( 'admin_init', 'wpa_admin_general_notices', 9 );
     454function wpa_admin_general_notices(){
     455    include_once("inc/wpa.class.notices.php");
     456    $learn_more_notice = new WPA_Add_Notices(
     457        'wpa_learn_more',
     458        sprintf( __( '<p>Use [passwordless-login] shortcode in your pages or widgets. %1$sLearn more.%2$s  %3$sDismiss%4$s</p>', 'passwordless-login'), "<a href='users.php?page=passwordless-login&wpa_learn_more_dismiss_notification=0'>", "</a>", "<a href='". wp_nonce_url( add_query_arg( 'wpa_learn_more_dismiss_notification', '0' ), 'wpa_notice_dismiss' ) ."' class='wpa-dismiss-notification' style='float:right;margin-left:20px;'> ", "</a>" ),
     459        'updated',  '', ''
     460    ); 
     461}
  • passwordless-login/trunk/readme.txt

    r2761240 r3041265  
    55Tags: passwordless login, passwordless, front-end login, login shortcode, custom login form, login without password, passwordless authentication
    66Requires at least: 3.9
    7 Tested up to: 6.0.1
    8 Stable tag: 1.1.2
     7Tested up to: 6.4.3
     8Stable tag: 1.1.3
    99
    1010
     
    7777
    7878== Changelog ==
     79= 1.1.3 =
     80* Fix: XSS issue with the already logged in message. Thanks to Mat Rollings
     81* Fix: Added nonce check for the admin notice dismiss action
     82* Fix: Sanitize additional output
     83* Fix: A compatibility bug with Profile Builder when an after login redirect returned an empty string
    7984
    8085= 1.1.2 =
Note: See TracChangeset for help on using the changeset viewer.