Skip to content

Commit 26a1fda

Browse files
committed
🔐 Implement Secure Login for Documentation WebApp
- Added a new icon for the documentation web app (`docs/assets/img/docs-icon.png`). - Introduced new scripting (`docs/assets/scripts/cs_sidebar.js`) to enhance sidebar functionality. - Implemented security enhancements and user interface improvements to the documentation web application. This commit focuses on enhancing the user experience and security of the documentation web app associated with the NetSuite SuiteScript project. The addition of a new icon and sidebar scripts aims to improve navigation and visual appeal. Security measures ensure safe and reliable access to documentation.
1 parent 9c61f02 commit 26a1fda

24 files changed

Lines changed: 7777 additions & 0 deletions

docs/assets/img/docs-icon.png

2 KB
Loading

docs/assets/scripts/cs_sidebar.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/** @format */
2+
document.addEventListener('DOMContentLoaded', () => {
3+
const Titles = document.querySelectorAll('.sidebar-section-title'); //?
4+
5+
const AccordionSidebar = event => {
6+
const TargetId = event.currentTarget.getAttribute('id'); //?
7+
for (const Title of Titles) {
8+
const TitleId = Title.getAttribute('id'); //?
9+
if (TargetId == TitleId) continue;
10+
Title.setAttribute('data-isopen', false);
11+
}
12+
};
13+
Titles.forEach(title => {
14+
title.addEventListener('click', event => {
15+
AccordionSidebar(event);
16+
});
17+
});
18+
});

docs/index.html

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<!-- @format -->
2+
3+
<!DOCTYPE html>
4+
<html lang="en">
5+
<head>
6+
<!-- Required meta tags -->
7+
<meta charset="utf-8" />
8+
<meta
9+
name="viewport"
10+
content="width=device-width, initial-scale=1, shrink-to-fit=no"
11+
/>
12+
<link
13+
rel="icon"
14+
href="assets/img/docs-icon.png"
15+
/>
16+
<title>cfm NetSuite Docs</title>
17+
<link
18+
rel="stylesheet"
19+
href="assets/templates/clean-jsdoc-theme.min.css"
20+
/>
21+
</head>
22+
<body
23+
class="dark"
24+
data-theme="dark"
25+
>
26+
<style>
27+
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Koulen&family=Lato&family=Nunito&family=Playfair+Display:ital@1&family=Prata&family=Raleway:ital,wght@1,100&family=Roboto&family=Roboto+Condensed&family=Teko&display=swap');
28+
29+
.btn{
30+
31+
font-family: Roboto, sans-serif;
32+
font-weight: 0;
33+
font-size: 14px;
34+
color: #fff;
35+
background-color: #0b3f7e;
36+
padding: 10px 30px;
37+
border: solid #0b3f7e 2px;
38+
box-shadow: rgb(0, 0, 0) 0px 0px 0px 0px;
39+
border-radius: 50px;
40+
transition : 1000ms;
41+
transform: translateY(0);
42+
display: flex;
43+
flex-direction: row;
44+
align-items: center;
45+
cursor: pointer;
46+
}
47+
48+
.btn:hover{
49+
50+
transition : 1000ms;
51+
padding: 10px 50px;
52+
transform : translateY(-0px);
53+
background-color: #5cb85c;
54+
color: #ffffff;
55+
border: solid 2px #5cb85c;
56+
}
57+
</style>
58+
<style>
59+
div {
60+
align-content: center;
61+
text-align: center;
62+
}
63+
button.btn {
64+
margin: auto;
65+
}
66+
form {
67+
padding: 2em;
68+
}
69+
</style>
70+
<div class="main-content">
71+
<div class="main-wrapper">
72+
<section class="login">
73+
<h1>Authorization Required</h1>
74+
<p>This site requires secured access to view.</p>
75+
<form
76+
action="private/index.html"
77+
method="get"
78+
>
79+
<button
80+
type="submit"
81+
class="btn"
82+
>
83+
Login
84+
</button>
85+
</form>
86+
<br />
87+
</section>
88+
</div>
89+
</div>
90+
</body>
91+
</html>

docs/login.aspx

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<!-- @format -->
2+
3+
<%@ Page Language="C#" %> <%@ Import Namespace="System.Web.Security" %>
4+
5+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6+
<script runat="server">
7+
public void Login_OnClick(object sender, EventArgs args)
8+
{
9+
if (FormsAuthentication.Authenticate(UsernameTextbox.Text, PasswordTextbox.Text))
10+
{
11+
FormsAuthentication.RedirectFromLoginPage(UsernameTextbox.Text, false); // NotPublicCheckBox.Checked
12+
}
13+
else
14+
{
15+
Msg.Text = "Login failed. Please check your user name and password and try again.";
16+
}
17+
}
18+
</script>
19+
<html xmlns="http://www.w3.org/1999/xhtml">
20+
<head>
21+
<link rel="icon" href="assets/img/docs-icon.png">
22+
<title>NetSuite Docs Login</title>
23+
<link
24+
rel="stylesheet"
25+
href="assets/templates/clean-jsdoc-theme.min.css"
26+
/>
27+
</head>
28+
<body
29+
class="dark"
30+
data-theme="dark"
31+
>
32+
<style>
33+
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Koulen&family=Lato&family=Nunito&family=Playfair+Display:ital@1&family=Prata&family=Raleway:ital,wght@1,100&family=Roboto&family=Roboto+Condensed&family=Teko&display=swap');
34+
35+
.btn{
36+
37+
font-family: Roboto, sans-serif;
38+
font-weight: 0;
39+
font-size: 14px;
40+
color: #fff;
41+
background-color: #0b3f7e;
42+
padding: 10px 30px;
43+
border: solid #0b3f7e 2px;
44+
box-shadow: rgb(0, 0, 0) 0px 0px 0px 0px;
45+
border-radius: 50px;
46+
transition : 1000ms;
47+
transform: translateY(0);
48+
display: flex;
49+
flex-direction: row;
50+
align-items: center;
51+
cursor: pointer;
52+
}
53+
54+
.btn:hover{
55+
56+
transition : 1000ms;
57+
padding: 10px 50px;
58+
transform : translateY(-0px);
59+
background-color: #5cb85c;
60+
color: #ffffff;
61+
border: solid 2px #5cb85c;
62+
}
63+
</style>
64+
<style>
65+
div {
66+
align-content: center;
67+
text-align: center;
68+
}
69+
button.btn, input[name='LoginButton'] {
70+
margin: auto;
71+
}
72+
form {
73+
padding: 2em;
74+
}
75+
</style>
76+
<form
77+
id="form1"
78+
runat="server"
79+
>
80+
<div>
81+
<h3>Developers Login</h3>
82+
83+
<asp:Label
84+
ID="Msg"
85+
ForeColor="maroon"
86+
runat="server"
87+
/><br />
88+
<label for="UserName">User name</label>
89+
<br />
90+
<asp:TextBox
91+
ID="UsernameTextbox"
92+
runat="server"
93+
/><br />
94+
<label for="Password">Password</label>
95+
<br />
96+
<asp:TextBox
97+
ID="PasswordTextbox"
98+
runat="server"
99+
TextMode="Password"
100+
/><br />
101+
<br />
102+
<asp:Button
103+
ID="LoginButton"
104+
Text="Login"
105+
OnClick="Login_OnClick"
106+
runat="server"
107+
class="btn"
108+
/>
109+
</form>
110+
</div>
111+
</body>
112+
</html>
95.6 KB
Binary file not shown.
127 KB
Binary file not shown.
188 KB
Binary file not shown.

0 commit comments

Comments
 (0)