File tree 3 files changed +37
-14
lines changed
3 files changed +37
-14
lines changed Original file line number Diff line number Diff line change 8
8
9
9
< body >
10
10
< div class ="login ">
11
- < div class ="back ">
12
- < - Back </ div >
13
- < h4 class ="title "> code-server</ h4 >
14
- < h2 class ="subtitle ">
15
- Enter server password
16
- </ h2 >
17
- < div class ="mdc-text-field ">
18
- < input type ="password " id ="password " class ="mdc-text-field__input " required >
19
- < label class ="mdc-floating-label " for ="password "> Password</ label >
20
- < div class ="mdc-line-ripple "> </ div >
21
- </ div >
22
- < button id ="submit " class ="mdc-button mdc-button--unelevated ">
23
- < span class ="mdc-button__label "> Enter IDE</ span >
24
- </ button >
11
+ < div class ="back "> < - Back </ div >
12
+ < h4 class ="title "> code-server</ h4 >
13
+ < h2 class ="subtitle ">
14
+ Enter server password
15
+ </ h2 >
16
+ < div class ="mdc-text-field ">
17
+ < input type ="password " id ="password " class ="mdc-text-field__input " required >
18
+ < label class ="mdc-floating-label " for ="password "> Password</ label >
19
+ < div class ="mdc-line-ripple "> </ div >
25
20
</ div >
21
+ < button id ="submit " class ="mdc-button mdc-button--unelevated ">
22
+ < span class ="mdc-button__label "> Enter IDE</ span >
23
+ </ button >
24
+ < div id ="error-display "> </ div >
26
25
</ div >
27
26
</ body >
28
27
Original file line number Diff line number Diff line change @@ -106,3 +106,16 @@ body {
106
106
107
107
// transition: 500ms opacity ease;
108
108
}
109
+
110
+ #error-display {
111
+ box-sizing : border-box ;
112
+ color : #bb2d0f ;
113
+ font-size : 14px ;
114
+ font-weight : 400 ;
115
+ letter-spacing : 0.3px ;
116
+ line-height : 12px ;
117
+ padding : 8px ;
118
+ padding-bottom : 0 ;
119
+ padding-top : 20px ;
120
+ text-align : center ;
121
+ }
Original file line number Diff line number Diff line change @@ -28,3 +28,14 @@ submit.addEventListener("click", () => {
28
28
document . cookie = `password=${ password . value } ` ;
29
29
location . reload ( ) ;
30
30
} ) ;
31
+
32
+ /**
33
+ * Notify user on load of page if previous password was unsuccessful
34
+ */
35
+ const reg = new RegExp ( `password=(\\w+);?` ) ;
36
+ const matches = document . cookie . match ( reg ) ;
37
+ const errorDisplay = document . getElementById ( "error-display" ) as HTMLDivElement ;
38
+
39
+ if ( document . referrer === document . location . href && matches ) {
40
+ errorDisplay . innerText = "Password is incorrect!" ;
41
+ }
You can’t perform that action at this time.
0 commit comments