Complete implementation of http authentication, fixes #19

This commit is contained in:
Jia Hao 2016-01-22 03:25:23 +08:00
parent 7ef855a297
commit f877928354
3 changed files with 69 additions and 5 deletions

View File

@ -0,0 +1,58 @@
label, input {
display: block;
}
* {
font-family: Verdana, sans-serif;
}
html, body {
height: 100%;
margin: 0;
-webkit-app-region: drag;
}
.login-form {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.login-form > div {
margin-bottom: 30px;
}
.login-form > div > label {
margin-bottom: 25px;
letter-spacing: 5px;
font-weight: 100;
text-transform: uppercase;
font-size: 18px;
text-align: center;
color: rgba(0, 0, 0, 0.7);
}
.login-form > div > input {
height: 30px;
width: 225px;
font-size: 16px;
-webkit-app-region: no-drag;
}
.login-form > div > button {
border: 0;
font-size: 15px;
font-weight: 100;
text-transform: uppercase;
margin-top: 20px;
height: 35px;
width: 225px;
background-color: #2196F3;
color: white;
-webkit-app-region: no-drag;
}
button:hover {
background-color: #0D47A1;
}

View File

@ -3,19 +3,20 @@
<head>
<meta charset="UTF-8">
<title>Login</title>
<link rel="stylesheet" type="text/css" href="login.css">
</head>
<body>
<form id="login-form">
<form class="login-form" id="login-form">
<div>
<label for="username-input">Username:</label>
<label for="username-input">Username</label>
<input type="text" id="username-input"/>
</div>
<div>
<label for="password-input">Password:</label>
<label for="password-input">Password</label>
<input type="password" id="password-input"/>
</div>
<div>
<button id="submit-form-button" type="submit">Send your message</button>
<button id="submit-form-button" type="submit">Login</button>
</div>
</form>
<script src="login.js"></script>

View File

@ -104,7 +104,12 @@ app.on('ready', function () {
app.on('login', function(event, webContents, request, authInfo, callback) {
event.preventDefault();
var loginWindow = new BrowserWindow();
var loginWindow = new BrowserWindow({
width: 300,
height: 400,
frame: false,
resizable: false
});
loginWindow.loadURL('file://' + __dirname + '/components/login/login.html');
ipcMain.once('login-message', function(event, usernameAndPassword) {