Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Reskin-payment All issues #57

Merged
merged 17 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ workflows:
- Hold [TC-Website-Build-Deploy]
filters:
branches:
only: [dev, dev-sts]
only: [dev, reskin-payment]
- build-prod:
context : org-global
requires:
Expand Down
6 changes: 3 additions & 3 deletions resources/ApplicationServer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ CONTEST_ELIGIBILITY_SERVICES_JNDI_NAME=remote/ContestEligibilityServiceBean
PIPELINE_SERVICE_FACADE_USERNAME=user
PIPELINE_SERVICE_FACADE_PASSWORD=password

SSO_COOKIE_KEY = tcsso_vm
SSO_COOKIE_KEY = tcsso
SSO_HASH_SECRET = GKDKJF80dbdc541fe829898aa01d9e30118bab5d6b9fe94fd052a40069385f5628
SSO_DOMAIN = topcoder.com
SSO_DOMAIN = topcoder-dev.com

#Json Web Token
JWT_COOKIE_KEY = tcjwt_vm
JWT_COOKIE_KEY = tcjwt
3 changes: 2 additions & 1 deletion resources/TC.properties
Original file line number Diff line number Diff line change
Expand Up @@ -831,4 +831,5 @@ discourse_callback_url = https://discourse.cloud.topcoder.com/session/sso_login?
unactivated_user_redirect_url = http://tcqa1.wpengine.com/account-inactive/

csrf_check_referer = true
csrf_check_origin = true
csrf_check_origin = true
login_url=https://accounts-auth0.topcoder-dev.com/
24 changes: 22 additions & 2 deletions src/main/com/topcoder/web/common/BaseServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLEncoder;
import java.util.List;
import java.util.Set;
import java.nio.charset.StandardCharsets;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
Expand All @@ -15,10 +17,13 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.hibernate.loader.custom.Return;

import com.topcoder.security.TCSubject;
import com.topcoder.shared.security.Authorization;
import com.topcoder.shared.security.Resource;
import com.topcoder.shared.security.SimpleResource;
import com.topcoder.shared.util.TCResourceBundle;
import com.topcoder.shared.security.User;
import com.topcoder.shared.util.logging.Logger;
import com.topcoder.web.common.error.RequestRateExceededException;
Expand Down Expand Up @@ -63,6 +68,9 @@ public abstract class BaseServlet extends HttpServlet {
public static final String URL_KEY = "url";
public static final String NEXT_PAGE_KEY = "nextpage";
public static final String SESSION_INFO_KEY = "sessionInfo";

private static TCResourceBundle bundle = null;

/**
* <p>
* Represent the qualified name of this class.
Expand All @@ -87,7 +95,9 @@ public synchronized void init(ServletConfig config) throws ServletException {
PATH = config.getInitParameter("processor_path");
DEFAULT_PROCESSOR = config.getInitParameter("default_processor");
LOGIN_PROCESSOR = config.getInitParameter("login_processor");

String styleConfig = config.getInitParameter("is_new_style");
bundle = new TCResourceBundle("TC");

if(styleConfig != null && styleConfig.equalsIgnoreCase("true")) {
NEW_STYLE_ENABLED = true;
Expand Down Expand Up @@ -220,6 +230,7 @@ protected void process(HttpServletRequest request, HttpServletResponse response)
authentication = createAuthentication(tcRequest, tcResponse);
TCSubject user = getUser(authentication.getActiveUser().getId());
info = createSessionInfo(tcRequest, authentication, user.getPrincipals());

//we can let browsers/proxies cache pages if the user is anonymous or it's https (they don't really cache https setuff)
if (log.isDebugEnabled()) {
log.debug("uri: " + request.getRequestURL().toString());
Expand Down Expand Up @@ -272,7 +283,6 @@ protected void process(HttpServletRequest request, HttpServletResponse response)

//log.debug("path " + PATH);
String processorName = getFullProcessorName(cmd);

if (log.isDebugEnabled()) {
log.debug("creating request processor for " + processorName);
}
Expand Down Expand Up @@ -483,7 +493,17 @@ protected void handleLogin(HttpServletRequest request, HttpServletResponse respo
request.setAttribute(NEXT_PAGE_KEY, info.getRequestString());

request.setAttribute(MODULE, LOGIN_PROCESSOR);
fetchRegularPage(request, response, LOGIN_SERVLET == null ? info.getServletPath() : LOGIN_SERVLET, true);
String loginUrl = bundle.getProperty("login_url", "");
StringBuffer returnUrl = new StringBuffer(info.getSecureAbsoluteServletPath());
returnUrl.append(info.getQueryString());
StringBuffer redirectUrl = new StringBuffer(loginUrl);
redirectUrl.append("?retUrl=").append(URLEncoder.encode(returnUrl.toString(), StandardCharsets.UTF_8.toString()));

// new login. redirect to auth0
fetchRegularPage(request, response, redirectUrl.toString(), false);

// OLD login
//fetchRegularPage(request, response, LOGIN_SERVLET == null ? info.getServletPath() : LOGIN_SERVLET, true);
}
}

Expand Down
36 changes: 34 additions & 2 deletions src/main/com/topcoder/web/jsp/foot.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.topcoder.shared.util.ApplicationServer,
com.topcoder.web.common.BaseServlet, com.topcoder.web.common.SessionInfo" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %>

<c:set value="<%=Boolean.parseBoolean(request.getParameter("isReskin"))%>" var="isReskin"/>

<%
SessionInfo sessionInfo = (SessionInfo)request.getAttribute(BaseServlet.SESSION_INFO_KEY);
Expand All @@ -24,10 +28,37 @@
}

String domainName = ApplicationServer.SERVER_NAME.replace("www.", "");

String year = new SimpleDateFormat("yyyy").format(new Date());
%>

<c:choose>
<c:when test="${isReskin}">
<footer class="footer-wrapper">
<nav class="footer-inner">
<div class="utils">
<span>&copy; <%=year%> Topcoder</span>
<a href="https://www.topcoder.com/policy">Policies</a>
</div>
<div class="social">
<a href="https://www.facebook.com/topcoder" target="_blank">
<img src="/i/reskin-2/social-fb-icon.svg">
</a>
<a href="https://www.youtube.com/channel/UCFv29ANLT2FQmtvS9DRixNA" target="_blank">
<img src="/i/reskin-2/social-yt-icon.svg">
</a>
<a href="https://www.linkedin.com/company/topcoder" target="_blank">
<img src="/i/reskin-2/social-linkedin-icon.svg">
</a>
<a href="https://twitter.com/topcoder" target="_blank">
<img src="/i/reskin-2/social-tw-icon.svg">
</a>
<a href="https://www.instagram.com/topcoder" target="_blank">
<img src="/i/reskin-2/social-insta-icon.svg">
</a>
</div>
</nav>
</footer>
</c:when>
<c:when test="${not empty isNewStyle && isNewStyle}">
<%--<footer id="footer">--%>
<%--<div class="container">--%>
Expand Down Expand Up @@ -167,8 +198,9 @@ analytics.identify('', {
});
</script>

<c:if test="${!isReskin}">
<!-- Start of topcoder Zendesk Widget script -->
<script>/*<![CDATA[*/window.zEmbed||function(e,t){var n,o,d,i,s,a=[],r=document.createElement("iframe");window.zEmbed=function(){a.push(arguments)},window.zE=window.zE||window.zEmbed,r.src="javascript:false",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="display: none",d=document.getElementsByTagName("script"),d=d[d.length-1],d.parentNode.insertBefore(r,d),i=r.contentWindow,s=i.document;try{o=s}catch(c){n=document.domain,r.src='javascript:var d=document.open();d.domain="'+n+'";void(0);',o=s}o.open()._l=function(){var o=this.createElement("script");n&&(this.domain=n),o.id="js-iframe-async",o.src=e,this.t=+new Date,this.zendeskHost=t,this.zEQueue=a,this.body.appendChild(o)},o.write('<body onload="document._l();">'),o.close()}("https://assets.zendesk.com/embeddable_framework/main.js","topcoder.zendesk.com");
/*]]>*/</script>
<!-- End of topcoder Zendesk Widget script -->

</c:if>
19 changes: 19 additions & 0 deletions src/main/com/topcoder/web/jsp/style.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<%
String key = request.getParameter("key");
Boolean isNewStyle = request.getAttribute("isNewStyle") == null ? false : (Boolean) request.getAttribute("isNewStyle");

String reskin = request.getParameter("reskin");
%>
<% if (!isNewStyle) { %>
<% if (key.equals("tc_old")) { %>
Expand Down Expand Up @@ -225,3 +227,20 @@
<link type="text/css" rel="stylesheet" href="/css/reskin/newStyles_ie8.css"/>
<![endif]-->
<% } %>

<% if (reskin != null) { %>
<link href='https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap' rel='stylesheet' type='text/css'/>
<% if (reskin.equals("paymentHistory")) { %>
<link type="text/css" rel="stylesheet" href="/css/reskin-2/common.css" />
<link type="text/css" rel="stylesheet" href="/css/reskin-2/top.css" />
<link type="text/css" rel="stylesheet" href="/css/reskin-2/paymentHistory.css" />
<link type="text/css" rel="stylesheet" href="/css/reskin-2/footer.css" />
<% } else if (reskin.equals("paymentStatusSummary")) { %>
<link type="text/css" rel="stylesheet" href="/css/reskin-2/common.css" />
<link type="text/css" rel="stylesheet" href="/css/reskin-2/top.css" />
<link type="text/css" rel="stylesheet" href="/css/reskin-2/paymentStatusSummary.css" />
<link type="text/css" rel="stylesheet" href="/css/reskin-2/footer.css" />
<% } %>
<% } %>
11 changes: 11 additions & 0 deletions src/main/com/topcoder/web/jsp/top.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="tc-webtags.tld" prefix="tc-webtag" %>

<c:set value="<%=Boolean.parseBoolean(request.getParameter("isReskin"))%>" var="isReskin"/>

<%
SessionInfo sessionInfo = (SessionInfo)request.getAttribute(BaseServlet.SESSION_INFO_KEY);
String level1 = request.getParameter("level1")==null?"competition":request.getParameter("level1");
Expand All @@ -55,6 +57,15 @@
</script>

<c:choose>
<c:when test="${isReskin}">
<header>
<nav class="primaryNav">
<a href="https://<%=ApplicationServer.SERVER_NAME%>/home" class="tcLogo">
<img src="/i/reskin-2/tc-logo-new.svg">
</a>
</nav>
</header>
</c:when>
<c:when test="${not empty isNewStyle && isNewStyle}">

<!-- new theme -->
Expand Down
Loading