From fstinglmayr at gmail.com Tue Jul 23 04:20:42 2013 From: fstinglmayr at gmail.com (Florian Stinglmayr) Date: Tue, 23 Jul 2013 10:20:42 +0200 Subject: [Mediawiki-el] Login with a domain Message-ID: <20130723082042.GA19875@adalon.xatronic.intern> Hi list, I have been using mediawiki.el for quite some time, and recently our company switched to a new version of mediawiki. With this change also came the integration of our mediawiki installation with LDAP. So now every time I login I also have to send the domain name for the LDAP otherwise the login fails. It's the "lgdomain" parameter of the "login" API action. Attached is a patch for mediawiki.el version 2.2.4.1 that adds domain support. You can specify the domain in the mediawiki alist (after the password) or otherwise it asks for it. Feel free to modify the patch and include it if you feel it's okay. Regards, Florian P.S.: My elisp magic is weak, so your mileage may vary. -------------- next part -------------- --- mediawiki.el.orig 2012-12-31 22:09:37.000000000 +0100 +++ mediawiki.el 2013-07-23 09:48:40.000000000 +0200 @@ -1230,12 +1230,16 @@ (or (mediawiki-site-extract sitename 3) (url-password-for-url (mediawiki-site-url sitename)))) +(defun mediawiki-site-domain (sitename) + "Get the domain for a given site." + (or (mediawiki-site-extract sitename 4))) + (defun mediawiki-site-first-page (sitename) "Get the password for a given site." - (mediawiki-site-extract sitename 4)) + (mediawiki-site-extract sitename 5)) -(defun mediawiki-do-login (&optional sitename username password) - "Use USERNAME and PASSWORD to log into the MediaWiki site and +(defun mediawiki-do-login (&optional sitename username password domain) + "Use USERNAME, PASSWORD, DOMAIN to log into the MediaWiki site and get a cookie." (interactive) (when (not sitename) @@ -1251,9 +1255,13 @@ (pass (or (mediawiki-site-password sitename) password (read-passwd "Password: "))) + (domain (or (mediawiki-site-domain sitename) + domain + (read-string "Domain: "))) (sitename sitename) (args (list (cons "lgname" user) - (cons "lgpassword" pass))) + (cons "lgpassword" pass) + (cons "lgdomain" domain))) (result (cadr (mediawiki-api-call sitename "login" args)))) (when (string= (cdr (assq 'result result)) "NeedToken") (setq result -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: not available URL: From fstinglmayr at gmail.com Tue Jul 23 15:21:56 2013 From: fstinglmayr at gmail.com (Florian Stinglmayr) Date: Tue, 23 Jul 2013 21:21:56 +0200 Subject: [Mediawiki-el] Login with a domain In-Reply-To: <20130723082042.GA19875@adalon.xatronic.intern> References: <20130723082042.GA19875@adalon.xatronic.intern> Message-ID: <20130723192156.GA20403@adalon.xatronic.intern> Hi list, resending the patch in the email. Sorry for the inconvinience. Regards, Florian --- mediawiki.el.orig 2012-12-31 22:09:37.000000000 +0100 +++ mediawiki.el 2013-07-23 09:48:40.000000000 +0200 @@ -1230,12 +1230,16 @@ (or (mediawiki-site-extract sitename 3) (url-password-for-url (mediawiki-site-url sitename)))) +(defun mediawiki-site-domain (sitename) + "Get the domain for a given site." + (or (mediawiki-site-extract sitename 4))) + (defun mediawiki-site-first-page (sitename) "Get the password for a given site." - (mediawiki-site-extract sitename 4)) + (mediawiki-site-extract sitename 5)) -(defun mediawiki-do-login (&optional sitename username password) - "Use USERNAME and PASSWORD to log into the MediaWiki site and +(defun mediawiki-do-login (&optional sitename username password domain) + "Use USERNAME, PASSWORD, DOMAIN to log into the MediaWiki site and get a cookie." (interactive) (when (not sitename) @@ -1251,9 +1255,13 @@ (pass (or (mediawiki-site-password sitename) password (read-passwd "Password: "))) + (domain (or (mediawiki-site-domain sitename) + domain + (read-string "Domain: "))) (sitename sitename) (args (list (cons "lgname" user) - (cons "lgpassword" pass))) + (cons "lgpassword" pass) + (cons "lgdomain" domain))) (result (cadr (mediawiki-api-call sitename "login" args)))) (when (string= (cdr (assq 'result result)) "NeedToken") (setq result -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: not available URL: