Permalink
Browse files

Improved Master Password window

  • Loading branch information...
1 parent ca158fa commit 30b4a9b90f8e2015ee7c7402d4a5a9f048690295 @saenzramiro committed Sep 26, 2016
Showing with 16 additions and 10 deletions.
  1. +3 −0 electron/main.js
  2. +13 −10 masterpassword.html
View
@@ -219,6 +219,9 @@ function createMasterPasswordWindow() {
backgroundColor: '#0675A0'
,frame: false
});
+ // Open the DevTools.
+ if ( isDev ) mainMasterPasswordWindow.webContents.openDevTools();
+
mainMasterPasswordWindow.loadURL('file://' + __dirname + '/../masterpassword.html');
mainMasterPasswordWindow.on('close', function() { mainMasterPasswordWindow = null });
}
View
@@ -9,19 +9,22 @@
<body>
<div style="background-image: url(resources/Icon.png);background-size:200px;width:200px;height:200px;position:relative;left:50%;margin-left:-100px;margin-top:100px;"></div>
<div style="color:#FFF;text-align:center;font-size:20px;font-family:Verdana;margin:30px 0;">Master Password</div>
- <div style="text-align:center;margin:30px 0;"><input type="password" autofocus placeholder="Enter your password..." onkeyup="doValidate(this.value)" style="text-align:center;font-size:20px;font-family:Verdana;padding:10px;" /></div>
+ <div style="text-align:center;margin:30px 0;"><input type="password" autofocus placeholder="Enter your password..." onkeyup="doValidate(event, this.value)" style="text-align:center;font-size:20px;font-family:Verdana;padding:10px;border: 0;" /><button onclick="onButtonClick()" style="height:44px;border:0;width:44px;position:relative;top:2px;font-size:30px;background-color:#053767;color:white;">&raquo;</button></div>
+ <div style="text-align:center;margin-top:60px;"><a href="#" onclick="exit()" style="text-decoration:none;color:#4e9dbb;font-family:Arial;">Exit Rambox</a></div>
<script>
- var to;
- function doValidate(value) {
- clearTimeout(to);
- to = setTimeout(function() {
- const {ipcRenderer} = require('electron');
- if ( ipcRenderer.sendSync('validateMasterPassword', value) ) {
- //require('electron').remote.
- } else {
+ function doValidate(e, value) {
+ if (e.keyCode == 13) {
+ const { ipcRenderer } = require('electron');
+ if ( !ipcRenderer.sendSync('validateMasterPassword', value) ) {
alert('The password is incorrect. Try again...');
}
- }, 3000);
+ }
+ }
+ function onButtonClick() {
+ return doValidate({ keyCode: 13 }, document.getElementsByTagName('input')[0].value);
+ }
+ function exit() {
+ require('electron').remote.app.quit();
}
</script>
</body>

0 comments on commit 30b4a9b

Please sign in to comment.