Browse Source

Merge pull request #1902 from gravitl/story/GRA-763-develop

feat(GRA-763): add success and error SSO HTML templates
Aceix 2 years ago
parent
commit
75dc77a6ea
1 changed files with 101 additions and 53 deletions
  1. 101 53
      auth/templates.go

+ 101 - 53
auth/templates.go

@@ -10,72 +10,120 @@ type ssoCallbackTemplateConfig struct {
 var ssoCallbackTemplate = template.Must(
 	template.New("ssocallback").Parse(`<!DOCTYPE html>
 	<html lang="en">
+	
 	<head>
-	  <meta charset="UTF-8">
-	  <meta name="viewport" content="width=device-width, initial-scale=1.0">
-	  <meta http-equiv="X-UA-Compatible" content="ie=edge">
-	  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
-		integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
-	  <title>Netmaker</title>
+		<meta charset="UTF-8">
+		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
+		<meta http-equiv="X-UA-Compatible" content="ie=edge">
+		<title>Netmaker :: SSO Success</title>
+	
+		<style>
+			html,
+			body {
+				margin: 0px;
+				padding: 0px;
+			}
+	
+			body {
+				height: 100vh;
+				overflow: hidden;
+				display: flex;
+				flex-flow: column nowrap;
+				justify-content: center;
+				align-items: center;
+			}
+	
+			#logo {
+				width: 150px;
+			}
+	
+			h3 {
+				margin-bottom: 3rem;
+				color: rgb(25, 135, 84);
+				font-size: xx-large;
+			}
+	
+			h4 {
+				margin-bottom: 0px;
+			}
+	
+			p {
+				margin-top: 0px;
+				margin-bottom: 0px;
+			}
+		</style>
 	</head>
-	<style>
-	  .text-responsive {
-		font-size: calc(100% + 1vw + 1vh);
-	  }
-	</style>
+	
 	<body>
-	  <div class="container">
-		<div class="row justify-content-center mt-5 p-5 align-items-center text-center">
-		  <a href="https://netmaker.io">
-			<img src="https://raw.githubusercontent.com/gravitl/netmaker/master/img/netmaker-teal.png" alt="Netmaker"
-			  width="75%" height="25%" class="img-fluid">
-		  </a>
-		</div>
-		<div class="row justify-content-center mt-5 p-3 text-center">
-		  <div class="col">
-			<h2 class="text-responsive">{{.User}} has been successfully {{.Verb}}</h2>
-			<br />
-			<h2 class="text-responsive">You may now close this window.</h2>
-		  </div>
-		</div>
-	  </div>
+		<img
+			src="https://raw.githubusercontent.com/gravitl/netmaker-docs/master/images/netmaker-github/netmaker-teal.png"
+			alt="netmaker logo"
+			id="logo"
+		>
+		<h3>Server SSO Success</h3>
+		<h4>User {{.User}} has been successfully {{.Verb}}.</h4>
+		<p>You can close this window now</p>
 	</body>
+	
 	</html>`),
 )
 
 var ssoErrCallbackTemplate = template.Must(
 	template.New("ssocallback").Parse(`<!DOCTYPE html>
 	<html lang="en">
+	
 	<head>
-	  <meta charset="UTF-8">
-	  <meta name="viewport" content="width=device-width, initial-scale=1.0">
-	  <meta http-equiv="X-UA-Compatible" content="ie=edge">
-	  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
-		integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
-	  <title>Netmaker</title>
+		<meta charset="UTF-8">
+		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
+		<meta http-equiv="X-UA-Compatible" content="ie=edge">
+		<title>Netmaker :: SSO Error</title>
+	
+		<style>
+			html, body {
+				margin: 0px;
+				padding: 0px;
+			}
+			body {
+				height: 100vh;
+				overflow: hidden;
+				display: flex;
+				flex-flow: column nowrap;
+				justify-content: center;
+				align-items: center;
+			}
+			#logo {
+				width: 150px;
+			}
+			h3 {
+				margin-bottom: 3rem;
+				color:rgb(223, 71, 89);
+				font-size: xx-large;
+			}
+			h4 {
+				margin-top: 0rem;
+			}
+			p {
+				margin-top: 3rem;
+			}
+		</style>
 	</head>
-	<style>
-	  .text-responsive {
-		font-size: calc(100% + 1vw + 1vh);
-		color: red;
-	  }
-	</style>
+
 	<body>
-	  <div class="container">
-		<div class="row justify-content-center mt-5 p-5 align-items-center text-center">
-		  <a href="https://netmaker.io">
-			<img src="https://raw.githubusercontent.com/gravitl/netmaker/master/img/netmaker-teal.png" alt="Netmaker"
-			  width="75%" height="25%" class="img-fluid">
-		  </a>
-		</div>
-		<div class="row justify-content-center mt-5 p-3 text-center">
-		  <div class="col">
-			<h2 class="text-responsive">{{.User}} unable to join network: {{.Verb}}</h2>
-			<br />
-			<h2 class="text-responsive">If you feel this is a mistake, please contact your network administrator.</h2>
-		  </div>
-		</div>
-	  </div>
+		<img
+			src="https://raw.githubusercontent.com/gravitl/netmaker-docs/master/images/netmaker-github/netmaker-teal.png"
+			alt="netmaker logo"
+			id="logo"
+		>
+		<h3>Server SSO Error</h3>
+		<h4>Error reason: {.Verb}</h4>
+		<em>Your Netmaker server may not have SSO configured properly.</em>
+		<em>
+			Please visit the <a href="https://docs.netmaker.org/oauth.html" target="_blank" rel="noopener">docs</a> for more information.
+		</em>
+		<p>
+			If you feel this is a mistake, please contact your network administrator.
+		</p>
 	</body>
+
 	</html>`),
 )