Skip to content

Commit 44ae325

Browse files
committed
end session action
1 parent 4bf9c2a commit 44ae325

File tree

5 files changed

+26
-1
lines changed

5 files changed

+26
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/ext/data/icon*png
1+
/ext/data/*.png

ext/data/main_popup.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ <h1 style="display:inline-block;margin-bottom:0.8em;">MasterPassword</h1>
4343
<input type="submit" value="OK" style="margin-top:1em;padding:0.1em 3em;"/>
4444
</form>
4545
</div>
46+
<div id="logoutbtn" style="display:none;position:absolute;right:1px;top:1px;width:32px;height:32px;;cursor:pointer;background-size:cover;background-image:url(exit.png)"></div>
4647

4748
<div id="main" style="position:relative;display:none">
4849
<select id="storedids" size="4" style="display:none;position:absolute;font-size:1.5em;width:99%;z-index:99"></select>

ext/data/main_popup.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ var mpw=null;
3131
var session_store={};
3232

3333
function recalculate() {
34+
$('#thepassword').html('(calculating)');
3435
$('#usermessage').html("Please wait...");
3536
if ($('#sitename').val()==null || $('#sitename').val()=="") {
3637
$('#usermessage').html("need sitename");
@@ -78,7 +79,9 @@ function popup(session_store_) {
7879
session_store = session_store_;
7980
if (session_store.username==null || session_store.masterkey==null) {
8081
$('#main').hide();
82+
$('#logoutbtn').hide();
8183
$('#sessionsetup').show();
84+
mpw=null;
8285
if (session_store.username==null)
8386
window.setTimeout(function(){$('#username').focus();},0.1);
8487
else {
@@ -87,6 +90,7 @@ function popup(session_store_) {
8790
}
8891
} else {
8992
recalc=true;
93+
$('#logoutbtn').show();
9094
$('#main').show();
9195
}
9296

@@ -118,14 +122,23 @@ $('#sessionsetup > form').on('submit', function(){
118122
}
119123
session_store.username=$('#username').val();
120124
session_store.masterkey=$('#masterkey').val();
125+
$('#masterkey').val('');
121126
addon.port.emit('store_update', session_store);
122127

123128
$('#sessionsetup').hide();
129+
$('#logoutbtn').show();
124130
$('#main').show();
125131
recalculate();
126132
return false;
127133
});
128134

135+
$('#logoutbtn').on('click',function(){
136+
session_store.masterkey=null;
137+
addon.port.emit('store_update', session_store);
138+
popup(session_store);
139+
$('#usermessage').html("session destroyed");
140+
});
141+
129142
$('#generatepassword').on('click', function(){
130143

131144
});

gfx/exit.svg

Lines changed: 6 additions & 0 deletions
Loading

gfx/makeicons.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22
for sizes in 16 32 64; do
33
convert -background transparent icon.svg -resize ${sizes}x${sizes} ../ext/data/icon${sizes}.png
44
done
5+
6+
sizes=32
7+
for files in "exit"; do
8+
convert -background transparent ${files}.svg -resize ${sizes}x${sizes} ../ext/data/${files}.png
9+
done

0 commit comments

Comments
 (0)