File tree Expand file tree Collapse file tree 3 files changed +37
-14
lines changed Expand file tree Collapse file tree 3 files changed +37
-14
lines changed Original file line number Diff line number Diff line change 88
99< body >
1010 < 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 >
2520 </ 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 >
2625 </ div >
2726</ body >
2827
Original file line number Diff line number Diff line change @@ -106,3 +106,16 @@ body {
106106
107107 // transition: 500ms opacity ease;
108108}
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", () => {
2828 document . cookie = `password=${ password . value } ` ;
2929 location . reload ( ) ;
3030} ) ;
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