Skip to content

Commit 5b64cb3

Browse files
committed
Fix login page
1 parent 712274d commit 5b64cb3

4 files changed

Lines changed: 123 additions & 122 deletions

File tree

src/login/index.html

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
5+
<title>Authenticate: code-server</title>
6+
<style>
7+
html {
8+
box-sizing: border-box;
9+
}
10+
11+
*, *:before, *:after {
12+
box-sizing: inherit;
13+
}
14+
15+
html, body {
16+
background-color: #FFFFFF;
17+
height: 100%;
18+
min-height: 100%;
19+
}
20+
21+
body {
22+
align-items: center;
23+
display: flex;
24+
font-family: "monospace";
25+
justify-content: center;
26+
margin: 0;
27+
padding: 10px;
28+
}
29+
30+
.login-form {
31+
border-radius: 5px;
32+
box-shadow: 0 18px 80px 10px rgba(69, 65, 78, 0.08);
33+
color: #575962;
34+
margin-top: -10%;
35+
max-width: 328px;
36+
padding: 40px;
37+
position: relative;
38+
width: 100%;
39+
}
40+
41+
.login-form > .title {
42+
text-align: center;
43+
text-transform: uppercase;
44+
font-size: 12px;
45+
font-weight: 500;
46+
letter-spacing: 1.5px;
47+
line-height: 15px;
48+
margin-bottom: 0px;
49+
margin-bottom: 5px;
50+
margin-top: 0px;
51+
}
52+
53+
.login-form > .subtitle {
54+
font-size: 19px;
55+
font-weight: bold;
56+
line-height: 25px;
57+
margin-bottom: 45px;
58+
margin: 0;
59+
text-align: center;
60+
}
61+
62+
.login-form > .field {
63+
text-align: left;
64+
font-size: 12px;
65+
color: #797E84;
66+
margin: 16px 0;
67+
}
68+
69+
.login-form > .field > .input {
70+
background: none !important;
71+
border: 1px solid #ccc;
72+
border-radius: 2px;
73+
padding: 5px;
74+
width: 100%;
75+
}
76+
77+
.login-form > .button {
78+
border: none;
79+
border-radius: 24px;
80+
box-shadow: 0 12px 17px 2px rgba(171,173,163,0.14), 0 5px 22px 4px rgba(171,173,163,0.12), 0 7px 8px -4px rgba(171,173,163,0.2);
81+
cursor: pointer;
82+
display: block;
83+
padding: 15px 5px;
84+
width: 100%;
85+
}
86+
87+
.login-form > .button:hover {
88+
background-color: rgb(0, 122, 204);
89+
color: #fff;
90+
}
91+
92+
.error-display {
93+
box-sizing: border-box;
94+
color: #bb2d0f;
95+
font-size: 14px;
96+
font-weight: 400;
97+
line-height: 12px;
98+
padding: 20px 8px 0;
99+
text-align: center;
100+
}
101+
</style>
102+
</head>
103+
<body>
104+
<form class="login-form" action="/login" method="post">
105+
<h4 class="title">code-server</h4>
106+
<h2 class="subtitle">
107+
Enter server password
108+
</h2>
109+
<div class="field">
110+
<!-- The onfocus code places the cursor at the end of the value. -->
111+
<input name="password" type="password" class="input" value=""
112+
required autofocus
113+
onfocus="const value=this.value;this.value='';this.value=value;">
114+
</div>
115+
<button class="button" type="submit">
116+
<span class="label">Enter IDE</span>
117+
</button>
118+
<div class="error-display" style="display:none">{{ERROR}}</div>
119+
</form>
120+
</body>
121+
</html>

src/login/login.css

Lines changed: 0 additions & 94 deletions
This file was deleted.

src/login/login.html

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ export abstract class Server {
241241
case "/login":
242242
if (!this.options.auth) {
243243
throw new HttpError("Not found", HttpCode.NotFound);
244-
} else if (requestPath === "") {
244+
} else if (requestPath === "/index.html") {
245245
return this.tryLogin(request);
246246
}
247247
this.ensureGet(request);
@@ -318,7 +318,7 @@ export abstract class Server {
318318
}
319319

320320
private async getLogin(error: string = "", payload?: LoginPayload): Promise<Response> {
321-
const filePath = path.join(this.rootPath, "out/vs/server/src/login/login.html");
321+
const filePath = path.join(this.rootPath, "out/vs/server/src/login/index.html");
322322
const content = (await util.promisify(fs.readFile)(filePath, "utf8"))
323323
.replace("{{ERROR}}", error)
324324
.replace("display:none", error ? "display:block" : "display:none")

0 commit comments

Comments
 (0)