includes/sessions.php
changeset 472 bc4b58034f4d
parent 471 7906fb190fc1
child 480 d5376271f96b
equal deleted inserted replaced
471:7906fb190fc1 472:bc4b58034f4d
  3193         }
  3193         }
  3194         
  3194         
  3195         $username =& $userinfo['username'];
  3195         $username =& $userinfo['username'];
  3196         $password =& $userinfo['password'];
  3196         $password =& $userinfo['password'];
  3197         
  3197         
       
  3198         // If we're logging in with a temp password, attach to the login_password_reset hook to send our JSON response
       
  3199         // A bit hackish since it just dies with the response :-(
       
  3200         $plugins->attachHook('login_password_reset', '$this->process_login_request(array(\'mode\' => \'respond_password_reset\', \'user_id\' => $row[\'user_id\'], \'temp_password\' => $row[\'temp_password\']));');
       
  3201         
  3198         // attempt the login
  3202         // attempt the login
  3199         // function login_without_crypto($username, $password, $already_md5ed = false, $level = USER_LEVEL_MEMBER, $captcha_hash = false, $captcha_code = false)
  3203         // function login_without_crypto($username, $password, $already_md5ed = false, $level = USER_LEVEL_MEMBER, $captcha_hash = false, $captcha_code = false)
  3200         $login_result = $this->login_without_crypto($username, $password, false, intval($req['level']), @$req['captcha_hash'], @$req['captcha_code']);
  3204         $login_result = $this->login_without_crypto($username, $password, false, intval($req['level']), @$req['captcha_hash'], @$req['captcha_code']);
  3201         
  3205         
  3202         if ( $login_result['success'] )
  3206         if ( $login_result['success'] )
  3217         }
  3221         }
  3218         
  3222         
  3219         break;
  3223         break;
  3220       case 'clean_key':
  3224       case 'clean_key':
  3221         // Clean out a key, since it won't be used.
  3225         // Clean out a key, since it won't be used.
       
  3226         // This is called when the user clicks Cancel in the AJAX login interface.
  3222         if ( !empty($req['key_aes']) )
  3227         if ( !empty($req['key_aes']) )
  3223         {
  3228         {
  3224           $this->fetch_public_key($req['key_aes']);
  3229           $this->fetch_public_key($req['key_aes']);
  3225         }
  3230         }
  3226         if ( !empty($req['key_dh']) )
  3231         if ( !empty($req['key_dh']) )
  3231             $db->die_json();
  3236             $db->die_json();
  3232         }
  3237         }
  3233         return array(
  3238         return array(
  3234             'mode' => 'noop'
  3239             'mode' => 'noop'
  3235           );
  3240           );
       
  3241         break;
       
  3242       case 'respond_password_reset':
       
  3243         die(enano_json_encode(array(
       
  3244             'mode' => 'login_success_reset',
       
  3245             'user_id' => $req['user_id'],
       
  3246             'temp_password' => $req['temp_password'],
       
  3247             'respawn_info' => $this->process_login_request(array('mode' => 'getkey'))
       
  3248           )));
  3236         break;
  3249         break;
  3237     }
  3250     }
  3238     
  3251     
  3239   }
  3252   }
  3240   
  3253