Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

changes to filtering and access page

  • Loading branch information...
commit 9594230af2746ed0e75b8effed56c3b1d851041e 1 parent 12f9530
Jared Williams authored
View
16 src/main/java/gov/nysenate/opendirectory/filters/ServiceFilter.java
@@ -1,6 +1,10 @@
package gov.nysenate.opendirectory.filters;
+import gov.nysenate.opendirectory.utils.UrlMapper;
+
import java.io.IOException;
+import java.io.PrintWriter;
+
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -12,7 +16,9 @@
public class ServiceFilter implements Filter {
- private final String IP_MATCH = "(10.\\d+.\\d+.\\d+|127.0.0.1|63.118.5[67].\\d+)";
+// private final String IP_MATCH = "(10.\\d+.\\d+.\\d+|63.118.5[67].\\d+)";
+ private final String IP_MATCH = "(127\\.0\\.0\\.1)";
+
public ServiceFilter() {
@@ -23,16 +29,18 @@ public void destroy() {
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
-
+// PrintWriter out = ((HttpServletResponse)response).getWriter();
+// out.println(request.getRemoteAddr());
if(((HttpServletRequest)request).getSession().getAttribute("uid") == null) {
if(!request.getRemoteAddr().matches(IP_MATCH)) {
String uri = ((HttpServletRequest)request).getRequestURI();
- if(uri.contains("/external") || uri.matches("^/opendirectory/(css|img)/.+$") || uri.startsWith("http://www.nysenate.gov")) {
+ if(uri.contains("/external") || uri.matches("^/opendirectory/(css|img)/.+$")) {
chain.doFilter(request, response);
}
else {
- ((HttpServletResponse)response).sendRedirect("http://www.nysenate.gov");
+ UrlMapper urls = new UrlMapper();
+ ((HttpServletResponse)response).sendRedirect(urls.url("external", "login"));
}
}
else {
View
1  src/main/webapp/jsp/access.jsp
@@ -24,6 +24,7 @@
<div id="nav_bar">
</div>
<div id="main" style="margin-top:50px;">
+ <h2 style="margin-left:30px;">Access OpenDirectory from outside the Senate network</h2>
<div id="main_center">
<% if(error_message != null) { %>
<div id="error">
View
2  src/main/webapp/jsp/header.jsp
@@ -41,7 +41,7 @@
</div>
<div id="nav_bar">
<form id="nav_search" action="<%=urls.url("search")%>" method="GET">
- Search:<input type="text" name="query" size="20" maxlength="255" value="" autocomplete="off" id="nav_search_input" />
+ <input type="text" name="query" size="20" maxlength="255" value="" autocomplete="off" id="nav_search_input" />
<input type="submit" value = "Search" id="nav_search_button"></input>
</form>
<div class="quickresult" id="quickresult-header"></div>
View
8 src/main/webapp/jsp/index.jsp
@@ -13,17 +13,17 @@
</form>
<div class="quickresult" id="quickresult-body" style="z-index:1;"></div>
</div>
- <div class="splash_new"><h2 class="homeText">Questions about Open Directory? See our <a href="/faq">FAQ</a></h2>
- <br />
+ <div class="splash_new"><h2 class="homeText">Questions about Open Directory? See our <a href="<%=urls.url("faq")%>">FAQ</a></h2>
+ <!-- <br />
<h2 class="homeUpdate">Recently Updated Profiles</h2>
<center>
- <ul class="splashProfiles">
+ <ul class="splashProfiles">
<li id="sp_1"><a href="" title=""><img src="" width="82.5" height="106.5" /></a></li>
<li id="sp_2"><a href="" title=""><img src="" width="82.5" height="106.5" /></a></li>
<li id="sp_3"><a href=" title=""><img src="" width="82.5" height="106.5" /></a></li>
<li id="sp_4"><a href="" title=""><img src="" width="82.5" height="106.5" /></a></li>
</ul>
- </center>
+ </center> -->
</div>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.