-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax_login.php
26 lines (23 loc) · 893 Bytes
/
ajax_login.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
include_once("./config.php");
require_once($wp_load);
$response = json_decode(file_get_contents('php://input'), true);
if(wp_verify_nonce($response['security'], 'instant_login_dsq')){
$info = array();
$info['user_login'] = $response['username'];
$info['user_password'] = $response['password'];
$info['remember'] = true;
$user_signon = wp_signon( $info, false);
if ( is_wp_error($user_signon) ){
echo json_encode(array('status'=>'401'));
} else {
wp_set_current_user($user_signon->ID);
wp_set_auth_cookie($user_signon->ID, false, false);
//$nonce = wp_create_nonce('send_pdf_nonce');
echo json_encode(array('status'=>'200'/*, 'nonce'=>$nonce*/));
}
}else{
echo json_encode(array('status'=>'440'));
}
die();
?>