Fix XML-RPC login method FS#2324

The login wasn't able to modify the session as it was already closed
earlier.

This patch also executes the correct event when logins via XMLRPC are
done.
This commit is contained in:
Andreas Gohr 2011-10-15 16:30:15 +02:00
parent a533b44005
commit fe13bd81bd

View file

@ -858,11 +858,22 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
global $auth; global $auth;
if(!$conf['useacl']) return 0; if(!$conf['useacl']) return 0;
if(!$auth) return 0; if(!$auth) return 0;
@session_start(); // reopen session for login
if($auth->canDo('external')){ if($auth->canDo('external')){
return $auth->trustExternal($user,$pass,false); $ok = $auth->trustExternal($user,$pass,false);
}else{ }else{
return auth_login($user,$pass,false,true); $evdata = array(
'user' => $user,
'password' => $pass,
'sticky' => false,
'silent' => true,
);
$ok = trigger_event('AUTH_LOGIN_CHECK', $evdata, 'auth_login_wrapper');
} }
session_write_close(); // we're done with the session
return $ok;
} }