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

Commit cccc5b8

Browse files
authored
Merge pull request #57 from topcoder-platform/reskin-payment
Reskin-payment All issues
2 parents dd871a2 + 6318121 commit cccc5b8

File tree

11 files changed

+794
-160
lines changed

11 files changed

+794
-160
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ workflows:
106106
- Hold [TC-Website-Build-Deploy]
107107
filters:
108108
branches:
109-
only: [dev, dev-sts]
109+
only: [dev, reskin-payment]
110110
- build-prod:
111111
context : org-global
112112
requires:

resources/ApplicationServer.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ CONTEST_ELIGIBILITY_SERVICES_JNDI_NAME=remote/ContestEligibilityServiceBean
6868
PIPELINE_SERVICE_FACADE_USERNAME=user
6969
PIPELINE_SERVICE_FACADE_PASSWORD=password
7070

71-
SSO_COOKIE_KEY = tcsso_vm
71+
SSO_COOKIE_KEY = tcsso
7272
SSO_HASH_SECRET = GKDKJF80dbdc541fe829898aa01d9e30118bab5d6b9fe94fd052a40069385f5628
73-
SSO_DOMAIN = topcoder.com
73+
SSO_DOMAIN = topcoder-dev.com
7474

7575
#Json Web Token
76-
JWT_COOKIE_KEY = tcjwt_vm
76+
JWT_COOKIE_KEY = tcjwt

resources/TC.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,4 +831,5 @@ discourse_callback_url = https://discourse.cloud.topcoder.com/session/sso_login?
831831
unactivated_user_redirect_url = http://tcqa1.wpengine.com/account-inactive/
832832

833833
csrf_check_referer = true
834-
csrf_check_origin = true
834+
csrf_check_origin = true
835+
login_url=https://accounts-auth0.topcoder-dev.com/

src/main/com/topcoder/web/common/BaseServlet.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55

66
import java.io.IOException;
77
import java.io.PrintWriter;
8+
import java.net.URLEncoder;
89
import java.util.List;
910
import java.util.Set;
11+
import java.nio.charset.StandardCharsets;
1012

1113
import javax.servlet.ServletConfig;
1214
import javax.servlet.ServletException;
@@ -15,10 +17,13 @@
1517
import javax.servlet.http.HttpServletRequest;
1618
import javax.servlet.http.HttpServletResponse;
1719

20+
import org.hibernate.loader.custom.Return;
21+
1822
import com.topcoder.security.TCSubject;
1923
import com.topcoder.shared.security.Authorization;
2024
import com.topcoder.shared.security.Resource;
2125
import com.topcoder.shared.security.SimpleResource;
26+
import com.topcoder.shared.util.TCResourceBundle;
2227
import com.topcoder.shared.security.User;
2328
import com.topcoder.shared.util.logging.Logger;
2429
import com.topcoder.web.common.error.RequestRateExceededException;
@@ -63,6 +68,9 @@ public abstract class BaseServlet extends HttpServlet {
6368
public static final String URL_KEY = "url";
6469
public static final String NEXT_PAGE_KEY = "nextpage";
6570
public static final String SESSION_INFO_KEY = "sessionInfo";
71+
72+
private static TCResourceBundle bundle = null;
73+
6674
/**
6775
* <p>
6876
* Represent the qualified name of this class.
@@ -87,7 +95,9 @@ public synchronized void init(ServletConfig config) throws ServletException {
8795
PATH = config.getInitParameter("processor_path");
8896
DEFAULT_PROCESSOR = config.getInitParameter("default_processor");
8997
LOGIN_PROCESSOR = config.getInitParameter("login_processor");
98+
9099
String styleConfig = config.getInitParameter("is_new_style");
100+
bundle = new TCResourceBundle("TC");
91101

92102
if(styleConfig != null && styleConfig.equalsIgnoreCase("true")) {
93103
NEW_STYLE_ENABLED = true;
@@ -220,6 +230,7 @@ protected void process(HttpServletRequest request, HttpServletResponse response)
220230
authentication = createAuthentication(tcRequest, tcResponse);
221231
TCSubject user = getUser(authentication.getActiveUser().getId());
222232
info = createSessionInfo(tcRequest, authentication, user.getPrincipals());
233+
223234
//we can let browsers/proxies cache pages if the user is anonymous or it's https (they don't really cache https setuff)
224235
if (log.isDebugEnabled()) {
225236
log.debug("uri: " + request.getRequestURL().toString());
@@ -272,7 +283,6 @@ protected void process(HttpServletRequest request, HttpServletResponse response)
272283

273284
//log.debug("path " + PATH);
274285
String processorName = getFullProcessorName(cmd);
275-
276286
if (log.isDebugEnabled()) {
277287
log.debug("creating request processor for " + processorName);
278288
}
@@ -483,7 +493,17 @@ protected void handleLogin(HttpServletRequest request, HttpServletResponse respo
483493
request.setAttribute(NEXT_PAGE_KEY, info.getRequestString());
484494

485495
request.setAttribute(MODULE, LOGIN_PROCESSOR);
486-
fetchRegularPage(request, response, LOGIN_SERVLET == null ? info.getServletPath() : LOGIN_SERVLET, true);
496+
String loginUrl = bundle.getProperty("login_url", "");
497+
StringBuffer returnUrl = new StringBuffer(info.getSecureAbsoluteServletPath());
498+
returnUrl.append(info.getQueryString());
499+
StringBuffer redirectUrl = new StringBuffer(loginUrl);
500+
redirectUrl.append("?retUrl=").append(URLEncoder.encode(returnUrl.toString(), StandardCharsets.UTF_8.toString()));
501+
502+
// new login. redirect to auth0
503+
fetchRegularPage(request, response, redirectUrl.toString(), false);
504+
505+
// OLD login
506+
//fetchRegularPage(request, response, LOGIN_SERVLET == null ? info.getServletPath() : LOGIN_SERVLET, true);
487507
}
488508
}
489509

src/main/com/topcoder/web/jsp/foot.jsp

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
1414
<%@ page import="com.topcoder.shared.util.ApplicationServer,
1515
com.topcoder.web.common.BaseServlet, com.topcoder.web.common.SessionInfo" %>
16+
<%@ page import="java.util.Date" %>
17+
<%@ page import="java.text.SimpleDateFormat" %>
18+
19+
<c:set value="<%=Boolean.parseBoolean(request.getParameter("isReskin"))%>" var="isReskin"/>
1620

1721
<%
1822
SessionInfo sessionInfo = (SessionInfo)request.getAttribute(BaseServlet.SESSION_INFO_KEY);
@@ -24,10 +28,37 @@
2428
}
2529
2630
String domainName = ApplicationServer.SERVER_NAME.replace("www.", "");
27-
31+
String year = new SimpleDateFormat("yyyy").format(new Date());
2832
%>
2933

3034
<c:choose>
35+
<c:when test="${isReskin}">
36+
<footer class="footer-wrapper">
37+
<nav class="footer-inner">
38+
<div class="utils">
39+
<span>&copy; <%=year%> Topcoder</span>
40+
<a href="https://www.topcoder.com/policy">Policies</a>
41+
</div>
42+
<div class="social">
43+
<a href="https://www.facebook.com/topcoder" target="_blank">
44+
<img src="/i/reskin-2/social-fb-icon.svg">
45+
</a>
46+
<a href="https://www.youtube.com/channel/UCFv29ANLT2FQmtvS9DRixNA" target="_blank">
47+
<img src="/i/reskin-2/social-yt-icon.svg">
48+
</a>
49+
<a href="https://www.linkedin.com/company/topcoder" target="_blank">
50+
<img src="/i/reskin-2/social-linkedin-icon.svg">
51+
</a>
52+
<a href="https://twitter.com/topcoder" target="_blank">
53+
<img src="/i/reskin-2/social-tw-icon.svg">
54+
</a>
55+
<a href="https://www.instagram.com/topcoder" target="_blank">
56+
<img src="/i/reskin-2/social-insta-icon.svg">
57+
</a>
58+
</div>
59+
</nav>
60+
</footer>
61+
</c:when>
3162
<c:when test="${not empty isNewStyle && isNewStyle}">
3263
<%--<footer id="footer">--%>
3364
<%--<div class="container">--%>
@@ -167,8 +198,9 @@ analytics.identify('', {
167198
});
168199
</script>
169200

201+
<c:if test="${!isReskin}">
170202
<!-- Start of topcoder Zendesk Widget script -->
171203
<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");
172204
/*]]>*/</script>
173205
<!-- End of topcoder Zendesk Widget script -->
174-
206+
</c:if>

src/main/com/topcoder/web/jsp/style.jsp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
<%
1515
String key = request.getParameter("key");
1616
Boolean isNewStyle = request.getAttribute("isNewStyle") == null ? false : (Boolean) request.getAttribute("isNewStyle");
17+
18+
String reskin = request.getParameter("reskin");
1719
%>
1820
<% if (!isNewStyle) { %>
1921
<% if (key.equals("tc_old")) { %>
@@ -225,3 +227,20 @@
225227
<link type="text/css" rel="stylesheet" href="/css/reskin/newStyles_ie8.css"/>
226228
<![endif]-->
227229
<% } %>
230+
231+
<% if (reskin != null) { %>
232+
<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'/>
233+
<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'/>
234+
<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'/>
235+
<% if (reskin.equals("paymentHistory")) { %>
236+
<link type="text/css" rel="stylesheet" href="/css/reskin-2/common.css" />
237+
<link type="text/css" rel="stylesheet" href="/css/reskin-2/top.css" />
238+
<link type="text/css" rel="stylesheet" href="/css/reskin-2/paymentHistory.css" />
239+
<link type="text/css" rel="stylesheet" href="/css/reskin-2/footer.css" />
240+
<% } else if (reskin.equals("paymentStatusSummary")) { %>
241+
<link type="text/css" rel="stylesheet" href="/css/reskin-2/common.css" />
242+
<link type="text/css" rel="stylesheet" href="/css/reskin-2/top.css" />
243+
<link type="text/css" rel="stylesheet" href="/css/reskin-2/paymentStatusSummary.css" />
244+
<link type="text/css" rel="stylesheet" href="/css/reskin-2/footer.css" />
245+
<% } %>
246+
<% } %>

src/main/com/topcoder/web/jsp/top.jsp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
3434
<%@ taglib uri="tc-webtags.tld" prefix="tc-webtag" %>
3535

36+
<c:set value="<%=Boolean.parseBoolean(request.getParameter("isReskin"))%>" var="isReskin"/>
37+
3638
<%
3739
SessionInfo sessionInfo = (SessionInfo)request.getAttribute(BaseServlet.SESSION_INFO_KEY);
3840
String level1 = request.getParameter("level1")==null?"competition":request.getParameter("level1");
@@ -55,6 +57,15 @@
5557
</script>
5658

5759
<c:choose>
60+
<c:when test="${isReskin}">
61+
<header>
62+
<nav class="primaryNav">
63+
<a href="https://<%=ApplicationServer.SERVER_NAME%>/home" class="tcLogo">
64+
<img src="/i/reskin-2/tc-logo-new.svg">
65+
</a>
66+
</nav>
67+
</header>
68+
</c:when>
5869
<c:when test="${not empty isNewStyle && isNewStyle}">
5970

6071
<!-- new theme -->

0 commit comments

Comments
 (0)