Skip to content
This repository
  • 5 commits
  • 5 files changed
  • 0 comments
  • 1 contributor
1  .gitignore
@@ -2,3 +2,4 @@
2 2 db/*.sqlite3
3 3 tmp/
4 4 log
  5 +backups
35 app/assets/javascripts/controllers.js.erb
@@ -69,7 +69,7 @@ function VaultsCtrl(Blob, Aes) {
69 69 this.resource = new Blob();
70 70 }
71 71 }
72   - Vault.prototype.import = function(data) {
  72 + Vault.prototype.importCsv = function(data) {
73 73 if (data) {
74 74 var lines = data.split('\n');
75 75 for (var i = 0; i < lines.length; i++) {
@@ -84,21 +84,21 @@ function VaultsCtrl(Blob, Aes) {
84 84 } else {
85 85 this.importing = true;
86 86 }
87   - };
  87 + }
88 88 Vault.prototype.lock = function() {
89 89 this.serialize();
90 90 this.locked = true;
91 91 this.cards = null;
92 92 this.progress(null);
93   - };
  93 + }
94 94 Vault.prototype.locked = true;
95 95 Vault.prototype.progress = function (status) {
96 96 this.status = status;
97 97 self.$eval();
98   - };
  98 + }
99 99 Vault.prototype.remove = function(card) {
100 100 this.cards.splice(this.cards.indexOf(card),1);
101   - };
  101 + }
102 102 Vault.prototype.serialize = function() {
103 103 if (this.locked) {
104 104 return;
@@ -126,7 +126,7 @@ function VaultsCtrl(Blob, Aes) {
126 126 this.cards = contents.map(function(c) { return new Card(c); });
127 127 this.resource.ctext = null;
128 128 this.progress(null);
129   - };
  129 + }
130 130 Vault.prototype.update = function(info) {
131 131 if (!info) {
132 132 return;
@@ -134,7 +134,7 @@ function VaultsCtrl(Blob, Aes) {
134 134 this.resource.name = info.name;
135 135 this.resource.crypto = info.crypto;
136 136 this.setPassword(info.password);
137   - };
  137 + }
138 138 var self = this;
139 139 Blob.index(function(r, hdrs) {
140 140 window._loaded = r;
@@ -159,10 +159,6 @@ function VaultsCtrl(Blob, Aes) {
159 159 crypto: crypto || "aesStandard",
160 160 cryptos: Aes.versions };
161 161 }
162   - self.editDetails = function(vault) {
163   - var updateInfo = showModalDialog("wallets/" + vault.id + "/edit", vaultDetails(vault.resource.name, vault.resource.crypto, false), "dialogwidth: 500; dialogheight: 500; ");
164   - vault.update(updateInfo);
165   - }
166 162 self.addVault = function() {
167 163 var vault = new Vault();
168 164 var creationInfo = showModalDialog("wallets/new", vaultDetails("Untitled", null, true), "dialogwidth: 450; dialogheight: 300; ");
@@ -172,6 +168,15 @@ function VaultsCtrl(Blob, Aes) {
172 168 self.selected = vault;
173 169 }
174 170 }
  171 + self.allowNewEdit = !(!showModalDialog);
  172 + self.editDetails = function(vault) {
  173 + var updateInfo = showModalDialog("wallets/" + vault.id + "/edit", vaultDetails(vault.resource.name, vault.resource.crypto, false), "dialogwidth: 500; dialogheight: 500; ");
  174 + vault.update(updateInfo);
  175 + }
  176 + self.lock = function(vault) {
  177 + vault.lock();
  178 + self.$eval();
  179 + }
175 180 self.remove = function(vault) {
176 181 if (confirm("Permanently remove '" + vault.resource.name + "'?")) {
177 182 self.vaults.splice(self.vaults.indexOf(vault),1);
@@ -190,10 +195,6 @@ function VaultsCtrl(Blob, Aes) {
190 195 self.selected = vault;
191 196 vault.selected = true;
192 197 }
193   - self.lock = function(vault) {
194   - vault.lock();
195   - self.$eval();
196   - }
197 198 self.unlock = function(password, vault) {
198 199 Aes.precompute(password, vault, function() {
199 200 var ptext;
@@ -204,7 +205,7 @@ function VaultsCtrl(Blob, Aes) {
204 205 }
205 206 vault.unlock(ptext);
206 207 });
207   - };
  208 + }
208 209 }
209 210 VaultsCtrl.$inject = ['Blob', 'Aes'];
210 211
@@ -231,7 +232,7 @@ function DetailsCtrl() {
231 232 }
232 233 }
233 234 document.getElementById("vaultName").value = args.name;
234   - if (args.new) {
  235 + if (args.isNew) {
235 236 document.getElementById("createButton").value = "Create";
236 237 }
237 238 }
8 app/assets/templates/vaults.html.erb
@@ -9,7 +9,7 @@
9 9 </div>
10 10 </ng:switch>
11 11 </div>
12   - <div ng:click="addVault()" class="vault-button">
  12 + <div ng:click="addVault()" class="vault-button" ng:show="allowNewEdit">
13 13 <div class="select-border border-normal">
14 14 New...
15 15 </div>
@@ -36,8 +36,8 @@
36 36 <button ng:click="lock(selected)">Lock</button>
37 37 <button ng:click="save(selected);lock(selected)">Save and Lock</button>
38 38 <button ng:click="save(selected)">Save</button>
39   - <button ng:click="editDetails(selected)">Settings...</button>
40   - <button ng:click="selected.import()">Import...</button>
  39 + <button ng:click="editDetails(selected)" ng:show="allowNewEdit">Settings...</button>
  40 + <button ng:click="selected.importCsv()">Import...</button>
41 41 <button ng:click="remove(selected)">Delete...</button>
42 42 </div>
43 43 <div class="vault-body">
@@ -81,7 +81,7 @@
81 81 Format is: <tt>uuid,group,title,url,user,password,notes</tt><br/>
82 82 <textarea name="importData" rows="5" cols="60"/>
83 83 <br/>
84   - <button ng:click="selected.import(importData)">Import</button>
  84 + <button ng:click="selected.import_csv(Importdata)">Import</button>
85 85 </div>
86 86 </div>
87 87 </div>
2  app/controllers/sessions_controller.rb
@@ -3,7 +3,7 @@ def new
3 3 end
4 4
5 5 def create
6   - user = User.authenticate(params[:login], params[:password])
  6 + user = User.authenticate(params[:login].downcase, params[:password])
7 7 if user
8 8 session[:user_id] = user.id
9 9 redirect_to_target_or_default root_url, :notice => "Logged in successfully."
2  app/views/wallets/edit_dialog.html.erb
@@ -14,7 +14,7 @@
14 14 <label name="crypto">Encryption: </label>
15 15 <select name="crypto" ng:options="c for c in cryptos"></select>
16 16 <br/>
17   - <input type="submit" name="submit"/>
  17 + <input type="submit" name="submit" id="createButton"/>
18 18 <button ng:click="cancel()">Cancel</button>
19 19 </form>
20 20 </div>

No commit comments for this range

Something went wrong with that request. Please try again.