| Server IP : 159.203.156.69 / Your IP : 216.73.217.172 Web Server : nginx/1.24.0 System : Linux main-ubuntu 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/php/green-estate-prod/wp-content/themes/spaciaz/inc/modules/ |
Upload File : |
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Spaciaz_Login' ) ) :
class Spaciaz_Login {
public function __construct() {
add_action( 'wp_ajax_spaciaz_login', array( $this, 'ajax_login' ) );
add_action( 'wp_ajax_nopriv_spaciaz_login', array( $this, 'ajax_login' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ), 10 );
}
public function scripts(){
wp_enqueue_script( 'spaciaz-ajax-login', get_template_directory_uri() . '/assets/js/frontend/login.js', array('jquery'), SPACIAZ_VERSION, true );
}
public function ajax_login() {
do_action( 'spaciaz_ajax_verify_captcha' );
check_ajax_referer( 'ajax-spaciaz-login-nonce', 'security-login' );
$info = array();
$info['user_login'] = $_REQUEST['username'];
$info['user_password'] = $_REQUEST['password'];
$info['remember'] = $_REQUEST['remember'];
$user_signon = wp_signon( $info, is_ssl() );
if ( is_wp_error( $user_signon ) ) {
wp_send_json( array(
'status' => false,
'msg' => esc_html__( 'Wrong username or password. Please try again!!!', 'spaciaz' )
) );
} else {
wp_set_current_user( $user_signon->ID );
wp_send_json( array(
'status' => true,
'msg' => esc_html__( 'Signin successful, redirecting...', 'spaciaz' )
) );
}
}
}
new Spaciaz_Login();
endif;