hi, I am very thankful you can reply me, but your solution looks not comfort me. I am using a Central Auth System to manage all user authcation. So when user are authenticated by this system, they should be logged in Mediawiki automatically. The system would access a .php file in Mediawiki such like http://wiki.xxxxx.org/myapi.org . So I must use this file to set mediawiki session. Could you tell me how to do? thx!
------------------ Bear 2010-08-12 ------------------------------------------------------------- From:Platonides Send Date:2010-08-12 17:35:33 To:wikitech-l CC: Subject:Re: [Wikitech-l] How to login a user without password? 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 [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
