From 634c07c04e77b131d67809d46aa62ebb6f53f602 Mon Sep 17 00:00:00 2001
From: Devesh <devesh.mehta@mantralabsglobal.com>
Date: Thu, 22 Aug 2019 14:08:10 +0530
Subject: [PATCH] Issue #SB-13927 fix:account merge: added back button and
 changed messages

---
 ansible/artifacts/sunbird/login/login.ftl     |  4 ++-
 .../login/messages/messages_en.properties     |  2 ++
 .../sunbird/login/resources/css/login.css     | 29 ++++++++++++++-----
 .../sunbird/login/resources/js/login.js       | 15 +++++++++-
 4 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/ansible/artifacts/sunbird/login/login.ftl b/ansible/artifacts/sunbird/login/login.ftl
index 672a576a8..5d8352a81 100644
--- a/ansible/artifacts/sunbird/login/login.ftl
+++ b/ansible/artifacts/sunbird/login/login.ftl
@@ -11,8 +11,9 @@
             <div class="ui column height-fix">
                 <div class="ui header centered">
                     <img onerror="" alt="">
-                    <div class="signInHead mt-27">${msg("doSignIn")}</div>
+                    <div id="signIn" class="signInHead mt-27">${msg("doSignIn")}</div>
                 </div>
+                <p id="mergeAccountMessage" class="hide mb-0 textCenter">${msg("mergeAccountMessage")}</p>
                 <div class="formMsg mb-28 textCenter">
                 <#if message?has_content>
                     <div class="ui text ${message.type}">
@@ -90,6 +91,7 @@
                         </#if>
                     </div>
                 </form>
+                 <a id="goBack" class="textCenter mt-16 hide cursor-pointer">${msg("goBack")}</a>
             </div>
             <div class="ui column tablet only computer only"></div>
         </div>
diff --git a/ansible/artifacts/sunbird/login/messages/messages_en.properties b/ansible/artifacts/sunbird/login/messages/messages_en.properties
index a50054c87..a39aae55a 100644
--- a/ansible/artifacts/sunbird/login/messages/messages_en.properties
+++ b/ansible/artifacts/sunbird/login/messages/messages_en.properties
@@ -52,6 +52,8 @@ consentDenied=Consent denied.
 
 noAccount=Don''t have an account?
 username=Username or Mobile number
+goBack=&#60;&#60;Go Back
+mergeAccountMessage=Enter Email Address/Phone number OR use Google Sign in to identify the account from which you want to merge usage details
 emailOrPhone=Mobile number / Email ID
 placeholderForEmailOrPhone=Enter Mobile number / Email ID
 firstName=First name
diff --git a/ansible/artifacts/sunbird/login/resources/css/login.css b/ansible/artifacts/sunbird/login/resources/css/login.css
index 9f72e3966..71863254a 100644
--- a/ansible/artifacts/sunbird/login/resources/css/login.css
+++ b/ansible/artifacts/sunbird/login/resources/css/login.css
@@ -2,7 +2,7 @@
 body{
     font-family: "Noto Sans";
     position: relative;
-    letter-spacing: 0.2px; 
+    letter-spacing: 0.2px;
 }
 .ui.container.fullpage-background-image{
     max-width: 320px !important;
@@ -14,6 +14,9 @@ body{
 .fs-14{
     font-size: 14px !important;
 }
+.fs-22{
+    font-size: 22px !important;
+}
 @media screen and (min-width: 768px) {
     body{
         background-size: cover;
@@ -21,7 +24,7 @@ body{
         min-height: 100vh;
         background: url(../img/bg.svg) no-repeat center center fixed;
         background-size: cover;
-        
+
      }
      .ui.container.fullpage-background-image{
         max-width: 944px !important;
@@ -47,14 +50,14 @@ body{
 input{
     border: 1px solid #9B9B9B !important;
 }
-input:focus{ 
+input:focus{
     border: 1px solid #024f9d !important;
 }
 .signInWithGoogle{
     vertical-align: bottom;
     height: 18px !important;
     margin-right: 5px;
-    
+
 }
 .ui.basic.blue.button.googleButton{
     color: #333 !important;
@@ -91,7 +94,7 @@ input:focus{
     margin-bottom: 10px !important;
 }
 .formMsg{
-    font-size: 16px;	
+    font-size: 16px;
     line-height: 22px;
 }
 .signInHead{
@@ -121,6 +124,9 @@ input:focus{
 .mb-28{
     margin-bottom: 28px !important;
 }
+.mb-0{
+    margin-bottom: 0px !important;
+}
 .mt-46{
     margin-top: 46px;
 }
@@ -130,6 +136,9 @@ input:focus{
 .mt-8 {
     margin-top: 8px !important;
 }
+.mt-16 {
+    margin-top: 16px !important;
+}
 .mb-18 {
     margin-bottom: 18px !important;
 }
@@ -163,9 +172,9 @@ input:focus{
 .mt-76{
     margin-top: 76px;
 }
-.backToLogin {	
+.backToLogin {
     color: #E76026 !important;
-    font-size: 14px;	
+    font-size: 14px;
     line-height: 19px;
     margin-top: 10px;
     display: block;
@@ -178,7 +187,7 @@ input:focus{
 }
 .button{
     color: #F9F9F9 !important;
-    font-size: 14px;	
+    font-size: 14px;
     line-height: 19px;
     background-color:#2CA58D !important;
 }
@@ -279,3 +288,7 @@ h1, h2, h3, h4, h5,
     flex-direction: column;
     justify-content: center;
 }
+
+.cursor-pointer {
+    cursor: pointer
+}
diff --git a/ansible/artifacts/sunbird/login/resources/js/login.js b/ansible/artifacts/sunbird/login/resources/js/login.js
index 50adf16dd..c60dce33a 100644
--- a/ansible/artifacts/sunbird/login/resources/js/login.js
+++ b/ansible/artifacts/sunbird/login/resources/js/login.js
@@ -30,8 +30,21 @@ window.onload = function(){
 		hideElement("kc-registration");
 		hideElement("stateButton");
 		hideElement("fgtKeycloakFlow");
+		var signIn = document.getElementById("signIn");
+		var goBackElement = document.getElementById("goBack");
+		if (signIn) {
+			signIn.innerText = 'Merge Account';
+			signIn.classList.add('fs-22');
+		}
+		if (goBackElement) {
+			goBackElement.className = goBackElement.className.replace("hide", "");
+			goBackElement.href = (new URLSearchParams(window.location.search)).get('goBackUrl');
+		}
+		var mergeAccountMessage = document.getElementById("mergeAccountMessage");
+		if (mergeAccountMessage) {
+			mergeAccountMessage.className = mergeAccountMessage.className.replace("hide", "");
+		}
 	}
-
 }
 var storeLocation = function(){
 	sessionStorage.setItem('url', window.location.href);
-- 
GitLab