← Back to team overview

dhis2-devs team mailing list archive

Re: ByPassing DHIS2 Login Page to Get to The Data Visualizer App

 

Hi Arthur, I guess the href in this line

<a href=*"http://localhost:8080/dhis/dhis-web-visualizer/index.html
<http://localhost:8080/dhis/dhis-web-visualizer/index.html>"* onclick
=autologging();>VEA *Dashboard*</a>

will redirect the user to the href url before the script has logged him in.
Try

<a href="#" onclick="javascript:autologging();">VEA Dashboard</a>

instead and see if it works.

On Wed, Jan 7, 2015 at 12:54 PM, Arthur Gwatidzo <arthur.g@xxxxxxxx> wrote:

> Hi Devs,
>
>
>
> I am trying to make an app that performs auto-login into DHIS2(bypassing
> the login screen and landing the user to the Data Visualizer app) through a
> script.
>
> I have created a user and assigned this user to a public user role that
> has the authority of “Viewing the Data Visualizer module” only.
>
>
>
> With the code below, I am still being landed to the DHIS2 login page, even
> though I have specified the login to be done through my script.
>
>
>
> I am not getting any errors in the console nor even the network tab.
>
>
>
> What could be the problem? See the snippet codes below
>
>
>
>
>
> HTML Code
>
> ===========
>
> <html>
>
> <header>
>
>              <title>VEA Public *Website*</title>
>
>              <link rel=*"stylesheet"* href=*"styles/style.css"* type=
> *"text/css"* media=*"screen"* />
>
>              <script type=*"text/javascript"* src=
> *"js/plugins/jquery-1.11.1.min.js"*></script>
>
>              <script type=*"text/javascript"* src=*"js/autologin.js"*></
> script>
>
> </header>
>
> <body>
>
>              <header>
>
>                            <nav id=*"navg"*>
>
>                                         <ul class=*"nav-list"*>
>
>                                                <li><a href = *"#"*>Home</a
> ></li>
>
>                                                <li><a href = *"#"*>About
> Us</a></li>
>
>                                                <li><a href=*"http://localhost:8080/dhis/dhis-web-visualizer/index.html
> <http://localhost:8080/dhis/dhis-web-visualizer/index.html>"* onclick
> =autologging();>VEA *Dashboard*</a>
>
>                                                <li><a href = *"#"*>Contact
> Us</a></li>
>
>                                         </ul>
>
>
>
>                            </nav>
>
>              </header>
>
>              <h3><center>Public VEA *Website*</center></h3>
>
> </body>
>
> </html>
>
>
>
>
>
> Script Code :* autologin.js*
>
> ===========
>
>
>
> *function* autologging(){
>
>        setTimeout(*function*() {
>
>            $.ajax({
>
>             type: "POST",
>
>             url: "
> http://localhost:8080/dhis/dhis-web-commons/security/login.action";,
>
>             cache: *false*,
>
>             async:*false*,
>
>             crossDomain: *true*,
>
>           //  contentType: "application/text",
>
>             data: { j_username: "vea_public", j_password: "V3apublic" }
>
>            }).done(*function*( data,textStatus,xhr ) {
>
>             alert( 'Welcome to the VEA Dashboard!' + xhr.status );
>
>           window.location ="
> http://localhost:8080/dhis/dhis-web-visualizer/index.html";;
>
>            });
>
>          }, 3000);
>
> }
>
>
>
>
>
>
>
> Kind Regards,
>
>
>
> Arthur  Gwatidzo
>
>
>
> [image: Description: cid:image001.png@01CCADE7.1D5397D0]
>
> Software Development and Information Systems
>
> *Health Information Systems Program*
>
> -----------------------------------------------
>
> Email:   arthur.g@xxxxxxxx
>
> Cell:      +27(0)768983930
>
> Skype:  Arthur.Gwatidzo
>
> Web*: *   http://www.hisp.org
>
>
>
> 66 Rigel Avenue North, Waterkloof Ridge
> Pretoria, 0181
> South Africa
> E -25.7847787 S 28.2347984
>
> This message may contain privileged and confidential information intended
> only for the person or entity to which it is addressed. Any review,
> retransmission, dissemination, copy or other use of, or taking of any
> action in reliance upon this information by persons or entities other than
> the intended recipient, is prohibited. If you received this message in
> error, please notify the sender immediately by e-mail, facsimile or
> telephone and thereafter delete the material from any computer. Any views
> expressed in this message are those of the individual sender, except where
> the sender specifically states them to be the view of the entity
> transmitting the message.
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>

PNG image


Follow ups

References