Use form for login to enable enter

This commit is contained in:
Midgard 2020-03-31 16:55:25 +02:00
parent 81751369a1
commit e7f7627c64
Signed by: midgard
GPG key ID: 511C112F1331BBB4
3 changed files with 10 additions and 8 deletions

View file

@ -28,7 +28,7 @@ input, button, textarea {
vertical-align: middle;
margin: 0;
}
button {
button, input[type=submit], input[type=button] {
padding: 0 0.5em;
cursor: pointer;
font-size: 90%;
@ -188,7 +188,7 @@ ul#server_selection_list {
#login:target {
display: block;
}
#login input {
#login input[type=text], #login input[type=password] {
width: 100%;
}
#login_server {

View file

@ -22,10 +22,10 @@
<div id="server_selection">
<ul id="server_selection_list"></ul>
<a href="#login"><button id="server_selection_add">Add a server</button></a>
<button id="server_selection_add">Add a server</button>
</div>
<div id="login">
<form id="login" action="#">
<h2>Add a server</h2>
<div class="login-form">
<input type="text" id="login_server" placeholder="Server URL" value="http://localhost:8080" required/>
@ -34,10 +34,10 @@
<input type="password" id="login_password" placeholder="Password" required/>
</div>
<button id="login_button">Log in</button>
<a href="#"><button id="server_selection_add">Cancel</button></a>
<input type="submit" id="login_button" value="Log in"/>
<input type="button" id="login_no_button" value="Cancel"/>
<div id="login_message"></div>
</div>
</form>
</div>
<ul id="channel_list"></ul>

View file

@ -1,6 +1,8 @@
"use strict";
byId("login_button").addEventListener("click", logIn);
byId("server_selection_add").addEventListener("click", e => { e.stopPropagation(); e.preventDefault(); window.location = "#login"; return false; });
byId("login").addEventListener("submit", e => { logIn(); e.stopPropagation(); e.preventDefault(); return false; });
byId("login_no_button").addEventListener("click", e => { e.stopPropagation(); e.preventDefault(); window.location = "#"; return false; });
updateComposeHeight();
checkScrolledToBottom();