Auto-Login to Piwik

Hi,

i use 3 Piwik installations on different servers for about 40 domains. Because it took so much time to switch between all the domains and installations to view the stats, i made one html-page with iframes of the current stats from all 40 domains.

So i can save a lot of time. Thanks a lot for the tool guys!

But theres one thing which i want to improve: I have to log in at each of the 3 installations first, before i can see my stats on the page with the iframes. I dont want to make the stats available for anonymous users - so i have to log in first - then i can see the stats on my page with the iframes.

I thought it must be possible to do some kind of auto-login. My way would be to put the login-urls of the 3 installations into 3 small iframes, which load the login-url including name and pw and put them on the page with all the iframes too.

I tried to get the url which is sent for the login with Firebug - but something seems missing, when i open this url, i dont login - i just get the login-form again.

Thats the url i tried:

http://my.domain.com/piwik/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today
&form_login=mylogin&form_password=mygreatpassword&form_url=http%3A%2F%2Fmy.domain.com%2Fpiwik
%2Findex.php%3Fmodule%3DCoreHome%26amp%3Baction%3Dindex%26amp%3B
idSite%3D1%26amp%3Bperiod%3Dday%26amp%3Bdate%3Dtoday


Can you tell me where i am wrong - or another way to get some kind of auto-login for my stats-page with all the iframes?

Thanks!

Hi _nk,

Instead of using GET with the provided URL I would try using POST somehow automated with the javascript in your iFrames subpages.

Generally, Piwik login screen POSTs variables using the following form:

<form  action="http://localhost:83/piwik_0_2_26/" method="post" name="loginform" id="loginform">
<p>
<label>Username:<br />
<input type="text" name="form_login" id="form_login" class="input" value="" size="20" tabindex="10" /></label>
</p>
<p>
<label>Password:<br />
<input type="password" name="form_password" id="form_password" class="input" value="" size="20" tabindex="20" /></label>
</p>
<input name="form_url" type="hidden" value="http://localhost:83/piwik_0_2_26/" />
<p class="submit">
<input type="submit" value="Sign in" tabindex="100" />

</p>
</form>

You could try to grab the above variables together with form name and try to POST it (automatically) using javascript code.

I hope I’m right style_emoticons/<#EMO_DIR#>/smile.gif

Hi michaelc, thanks for your help.

Can you give me an example of how to do a post by javascript? I have no experience in this field. Especially because i have to post the data to three different urls, how can i accomplish that?

Thanks!


Free Pictures & Images for Webmasters:
English: Pictures [/url]| French: Images | German: [url=http://bilder.n3po.com]Bilder

There’s a proposed patch in Trac, ticket 514 (HTTP_AUTH login forwarded to Piwik) that might serve your needs.

hi robocoder,

thanks for your reply. i installed the patch as a plugin and activated it - but i get a error-message:

Fatal error: Call to undefined method Piwik_HttpAuthLogin_Auth::setLogin() in /usr/www/users/xyz/piwik/plugins/Login/Controller.php on line 76

There is no setLogin() in the HTTPAuth Plugin - can you tell me what to do?

[size=8pt]Free resources for webmasters:
Netherlands: Afbeeldingen [/url]| Croatia: Slike | Czech: [url=http://obrazky.n3po.com]Obrazky[/size]

Hmm… sounds like the submitted patch is incomplete. Back it out for now. There’s some auth refactoring on the way (to support Zend OpenID).