File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 7
7
</ head >
8
8
9
9
< body >
10
- < form action =" javascript:history.go(0) ">
10
+ < form id =" login-form ">
11
11
< div class ="login ">
12
12
< div class ="back ">
13
13
< - Back </ div > < h4 class ="title "> code-server</ h4 >
14
14
< h2 class ="subtitle ">
15
15
Enter server password
16
16
</ h2 >
17
- < form >
18
17
< div class ="mdc-text-field ">
19
18
< input type ="password " id ="password " class ="mdc-text-field__input " required >
20
19
< label class ="mdc-floating-label " for ="password "> Password</ label >
@@ -23,7 +22,6 @@ <h2 class="subtitle">
23
22
< button id ="submit " class ="mdc-button mdc-button--unelevated ">
24
23
< span class ="mdc-button__label "> Enter IDE</ span >
25
24
</ button >
26
- </ form >
27
25
< div id ="error-display "> </ div >
28
26
</ div >
29
27
</ form >
Original file line number Diff line number Diff line change @@ -21,10 +21,14 @@ window.addEventListener("message", (event) => {
21
21
22
22
const password = document . getElementById ( "password" ) as HTMLInputElement ;
23
23
const submit = document . getElementById ( "submit" ) as HTMLButtonElement ;
24
+ const form = document . getElementById ( "login-form" ) as HTMLFormElement ;
25
+
24
26
if ( ! submit ) {
25
27
throw new Error ( "No submit button found" ) ;
26
28
}
27
- submit . addEventListener ( "click" , ( ) => {
29
+
30
+ form . addEventListener ( "submit" , ( e ) => {
31
+ e . preventDefault ( ) ;
28
32
document . cookie = `password=${ password . value } ` ;
29
33
location . reload ( ) ;
30
34
} ) ;
You can’t perform that action at this time.
0 commit comments