Bear wrote:
> hi,
> I am working on developing some auth extensions these days. Now I have 
> already done halt of my project. I extended a new class from AuthPlugin and 
> write my code in it, it works fine. But I want to do more on this. For 
> example, I wanna make Mediawiki login automaticlly when I logged in other 
> applications.
> When I logged in an other application, the application would call a file in 
> Mediawiki, for example, I installed my forum in forum.xxxxx.org and mediawiki 
> in wiki.xxxxx.org, when I logged in forum, the forum would access 
> http://wiki.xxxxx.org/myapi.php automatically and POST user ID to it. Now I 
> must make myapi.php to set a session to make mediawiki show the user has been 
> logged in. I have read the Mediawiki API but it cannot satisfy me, because it 
> need some more information which I cannot supply such like users password. So 
> is there anyway to make a user logged in without a clear-text password? thx!!

No need to do that:
http://www.mediawiki.org/wiki/Manual:Hooks/UserLoadFromSession

> BTW: I found another problem on a class which extended from AuthPlugin.
> When I 'echo' something in 
> function authenticate($username, $password)
> it wont shown on page. Only when I added exit(); to stop program running, my 
> message can be shown. For example, If I use this code:
> function authenticate($username, $password){
>               echo 'aaaaaaaaaaaaaaaaaaaaaaa';
>               //Do something to auth
>               return true;
> }
> Nothing would shown, it would redirected to LoginComplete page directly.
> And also, if I use a hook:
> $wgHooks['UserLoginComplete'][] = 'WMHook_UserLoginComplete';
> and 'echo' something in function WMHook_UserLoginComplete():
> function WMHook_UserLoginComplete(&$user, &$inject_html){
>       $uid = $user->getId();
>       echo $uid;
>       return true;
> }
> Nothing would be shown. If I modified the $inject_html like:
> function WMHook_UserLoginComplete(&$user, &$inject_html){
>       $inject_html = 'aaaaaaaaaaaaaaaaaa';
>       return true;
> }
> Whatever value I passed to $inject_html execpt empty string would cause 
> Mediawiki stop working. Nothing would shown and the program was stop.
> Could you tell me why this happed? thx

Because you are being redirected. Set $wgDebugRedirects = true; in
LocalSettings to see them.



_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to