=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login_mobile.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login_mobile.vm 2012-10-03 10:33:08 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login_mobile.vm 2012-10-29 14:37:17 +0000 @@ -24,14 +24,18 @@ #end -

Login

-
-
+
+

+
+

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/MappedRedirectStrategy.java' --- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/MappedRedirectStrategy.java 2012-06-27 08:00:02 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/MappedRedirectStrategy.java 2012-10-29 14:37:17 +0000 @@ -88,10 +88,17 @@ } } - if ( device.isMobile() ) + String mobileVersion = (String) request.getAttribute( "mobileVersion" ); + mobileVersion = mobileVersion == null ? "basic" : mobileVersion; + + if ( mobileVersion.equals( "basic" ) ) { url = getRootPath( request ) + "/light/index.action"; } + else if ( mobileVersion.equals( "smartphone" ) ) + { + url = getRootPath( request ) + "/mobile"; + } log.debug( "Redirecting to " + url ); === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/action/LoginAction.java' --- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/action/LoginAction.java 2012-10-19 09:49:13 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/action/LoginAction.java 2012-10-29 14:37:17 +0000 @@ -1,3 +1,5 @@ +package org.hisp.dhis.security.action; + /* * Copyright (c) 2004-2012, University of Oslo * All rights reserved. @@ -25,8 +27,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package org.hisp.dhis.security.action; - import org.apache.struts2.ServletActionContext; import org.springframework.mobile.device.Device; import org.springframework.mobile.device.DeviceResolver; === added file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/filter/CustomAuthenticationFilter.java' --- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/filter/CustomAuthenticationFilter.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/filter/CustomAuthenticationFilter.java 2012-10-29 14:37:17 +0000 @@ -0,0 +1,61 @@ +package org.hisp.dhis.security.filter; + +/* + * Copyright (c) 2004-2012, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import javax.servlet.*; +import java.io.IOException; + +/** + * @author Morten Olav Hansen + */ +public class CustomAuthenticationFilter + implements Filter +{ + @Override + public void init( FilterConfig filterConfig ) throws ServletException + { + } + + @Override + public void doFilter( ServletRequest request, ServletResponse response, FilterChain filterChain ) throws IOException, ServletException + { + String mobileVersion = request.getParameter( "mobileVersion" ); + + if ( mobileVersion != null ) + { + request.setAttribute( "mobileVersion", mobileVersion ); + } + + filterChain.doFilter( request, response ); + } + + @Override + public void destroy() + { + } +} === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml 2012-10-23 13:38:24 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml 2012-10-29 14:37:17 +0000 @@ -23,6 +23,8 @@ + + @@ -43,6 +45,7 @@ +