Plugin Directory

Changeset 872768

Timestamp:
03/10/2014 02:26:15 PM (10 years ago)
Author:
filosofo
Message:

Add 1.0.2 tag directory.

Location:
wp-restful-single-sign-on
Files:
11 added
3 edited

Legend:

Unmodified
Added
Removed
  • wp-restful-single-sign-on/trunk/RestfulSingleSignOn/HttpResponse.php

    r836382 r872768  
    229229    {
    230230        $resp = null;
    231         if (!empty($wp_response)) {
     231        if (!empty($wp_response)) {
    232232            $body = isset($wp_response['body']) ? $wp_response['body'] : '';
    233233            $resp = new RestfulSingleSignOn_HttpResponse($body);
  • wp-restful-single-sign-on/trunk/RestfulSingleSignOnPlugin.php

    r836382 r872768  
    209209                    if (!empty($email_property) && !empty($current_user_endpoint)) {
    210210                        $resp = $this->_getAuthInterface()->getCurrentUserInfo($_COOKIE[$auth_cookie_name]);
    211                         $data = $resp->getParsedBody();
    212                         if (
    213                             (!$data instanceof WP_Error)
    214                             && !empty($data[$email_property])
    215                         ) {
    216                             $found_user = get_user_by('email', $data[$email_property]);
    217                             if (!empty($found_user->ID)) {
    218                                 $current_user = $found_user;
    219                                 wp_set_current_user($found_user->ID);
     211                        if (!is_null($resp)) {
     212                            $data = $resp->getParsedBody();
     213                            if (
     214                                (!$data instanceof WP_Error)
     215                                && !empty($data[$email_property])
     216                            ) {
     217                                $found_user = get_user_by('email', $data[$email_property]);
     218                                if (!empty($found_user->ID)) {
     219                                    $current_user = $found_user;
     220                                    wp_set_current_user($found_user->ID);
     221                                }
    220222                            }
    221223                        }
     
    440442                    if ($db_user->get('restful_sso_user')) {
    441443                        $resp = $this->_getAuthInterface()->authenticateUser($username, $password);
     444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
    442458                        $data = $resp->getParsedBody();
    443459                        if (!$data instanceof WP_Error) {
    444                             $user = $db_user;
     460                            // Let's create a user in the WordPress system corresponding to the user.
     461                            $arbitrary_password = sha1(uniqid(microtime()));
     462                            $user_id = wp_create_user($username, $arbitrary_password, $data[$email_property]);
     463                            update_user_meta($user_id, 'first_name', $data[$first_name_property]);
     464                            update_user_meta($user_id, 'last_name', $data[$last_name_property]);
     465                            update_user_meta($user_id, 'restful_sso_user', true);
     466
     467                            $user = get_user_by('id', $user_id);
    445468                            if (0 < count($cookies_to_set)) {
    446469                                $this->_set_cookies_from_response($cookies_to_set, $cookie_domain, $resp);
    447470                            }
    448                         }
    449                     }
    450 
    451                 } else {
    452                     $resp = $this->_getAuthInterface()->authenticateUser($username, $password);
    453                     $data = $resp->getParsedBody();
    454                     if (!$data instanceof WP_Error) {
    455                         // Let's create a user in the WordPress system corresponding to the user.
    456                         $arbitrary_password = sha1(uniqid(microtime()));
    457                         $user_id = wp_create_user($username, $arbitrary_password, $data[$email_property]);
    458                         update_user_meta($user_id, 'first_name', $data[$first_name_property]);
    459                         update_user_meta($user_id, 'last_name', $data[$last_name_property]);
    460                         update_user_meta($user_id, 'restful_sso_user', true);
    461 
    462                         $user = get_user_by('id', $user_id);
    463                         if (0 < count($cookies_to_set)) {
    464                             $this->_set_cookies_from_response($cookies_to_set, $cookie_domain, $resp);
    465471                        }
    466472                    }
     
    496502                            $username = $user->user_email;
    497503                            $resp = $this->_getAuthInterface()->requestPasswordReset($username);
    498                             $result = $resp->getParsedBody();
    499                             if ($result instanceof WP_Error) {
    500                                 $phpmailer = new RestfulSingleSignOn_DummyMailer(false, $result);
    501                             } else {
    502                                 $phpmailer = new RestfulSingleSignOn_DummyMailer(false, true);
     504                            if (!is_null($resp)) {
     505                                $result = $resp->getParsedBody();
     506                                if ($result instanceof WP_Error) {
     507                                    $phpmailer = new RestfulSingleSignOn_DummyMailer(false, $result);
     508                                } else {
     509                                    $phpmailer = new RestfulSingleSignOn_DummyMailer(false, true);
     510                                }
    503511                            }
    504512                        }
  • wp-restful-single-sign-on/trunk/readme.txt

    r836382 r872768  
    55Requires at least: 3.8
    66Tested up to: 3.8
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5656== Changelog ==
    5757
     58
     59
     60
    5861= 1.0 =
    5962Initial release of plugin
Note: See TracChangeset for help on using the changeset viewer.