Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: kevinpet/wallet
base: 3c57bc3bdd
...
head fork: kevinpet/wallet
compare: e28646e260
  • 5 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
1  .gitignore
@@ -2,3 +2,4 @@
db/*.sqlite3
tmp/
log
+backups
View
35 app/assets/javascripts/controllers.js.erb
@@ -69,7 +69,7 @@ function VaultsCtrl(Blob, Aes) {
this.resource = new Blob();
}
}
- Vault.prototype.import = function(data) {
+ Vault.prototype.importCsv = function(data) {
if (data) {
var lines = data.split('\n');
for (var i = 0; i < lines.length; i++) {
@@ -84,21 +84,21 @@ function VaultsCtrl(Blob, Aes) {
} else {
this.importing = true;
}
- };
+ }
Vault.prototype.lock = function() {
this.serialize();
this.locked = true;
this.cards = null;
this.progress(null);
- };
+ }
Vault.prototype.locked = true;
Vault.prototype.progress = function (status) {
this.status = status;
self.$eval();
- };
+ }
Vault.prototype.remove = function(card) {
this.cards.splice(this.cards.indexOf(card),1);
- };
+ }
Vault.prototype.serialize = function() {
if (this.locked) {
return;
@@ -126,7 +126,7 @@ function VaultsCtrl(Blob, Aes) {
this.cards = contents.map(function(c) { return new Card(c); });
this.resource.ctext = null;
this.progress(null);
- };
+ }
Vault.prototype.update = function(info) {
if (!info) {
return;
@@ -134,7 +134,7 @@ function VaultsCtrl(Blob, Aes) {
this.resource.name = info.name;
this.resource.crypto = info.crypto;
this.setPassword(info.password);
- };
+ }
var self = this;
Blob.index(function(r, hdrs) {
window._loaded = r;
@@ -159,10 +159,6 @@ function VaultsCtrl(Blob, Aes) {
crypto: crypto || "aesStandard",
cryptos: Aes.versions };
}
- self.editDetails = function(vault) {
- var updateInfo = showModalDialog("wallets/" + vault.id + "/edit", vaultDetails(vault.resource.name, vault.resource.crypto, false), "dialogwidth: 500; dialogheight: 500; ");
- vault.update(updateInfo);
- }
self.addVault = function() {
var vault = new Vault();
var creationInfo = showModalDialog("wallets/new", vaultDetails("Untitled", null, true), "dialogwidth: 450; dialogheight: 300; ");
@@ -172,6 +168,15 @@ function VaultsCtrl(Blob, Aes) {
self.selected = vault;
}
}
+ self.allowNewEdit = !(!showModalDialog);
+ self.editDetails = function(vault) {
+ var updateInfo = showModalDialog("wallets/" + vault.id + "/edit", vaultDetails(vault.resource.name, vault.resource.crypto, false), "dialogwidth: 500; dialogheight: 500; ");
+ vault.update(updateInfo);
+ }
+ self.lock = function(vault) {
+ vault.lock();
+ self.$eval();
+ }
self.remove = function(vault) {
if (confirm("Permanently remove '" + vault.resource.name + "'?")) {
self.vaults.splice(self.vaults.indexOf(vault),1);
@@ -190,10 +195,6 @@ function VaultsCtrl(Blob, Aes) {
self.selected = vault;
vault.selected = true;
}
- self.lock = function(vault) {
- vault.lock();
- self.$eval();
- }
self.unlock = function(password, vault) {
Aes.precompute(password, vault, function() {
var ptext;
@@ -204,7 +205,7 @@ function VaultsCtrl(Blob, Aes) {
}
vault.unlock(ptext);
});
- };
+ }
}
VaultsCtrl.$inject = ['Blob', 'Aes'];
@@ -231,7 +232,7 @@ function DetailsCtrl() {
}
}
document.getElementById("vaultName").value = args.name;
- if (args.new) {
+ if (args.isNew) {
document.getElementById("createButton").value = "Create";
}
}
View
8 app/assets/templates/vaults.html.erb
@@ -9,7 +9,7 @@
</div>
</ng:switch>
</div>
- <div ng:click="addVault()" class="vault-button">
+ <div ng:click="addVault()" class="vault-button" ng:show="allowNewEdit">
<div class="select-border border-normal">
New...
</div>
@@ -36,8 +36,8 @@
<button ng:click="lock(selected)">Lock</button>
<button ng:click="save(selected);lock(selected)">Save and Lock</button>
<button ng:click="save(selected)">Save</button>
- <button ng:click="editDetails(selected)">Settings...</button>
- <button ng:click="selected.import()">Import...</button>
+ <button ng:click="editDetails(selected)" ng:show="allowNewEdit">Settings...</button>
+ <button ng:click="selected.importCsv()">Import...</button>
<button ng:click="remove(selected)">Delete...</button>
</div>
<div class="vault-body">
@@ -81,7 +81,7 @@
Format is: <tt>uuid,group,title,url,user,password,notes</tt><br/>
<textarea name="importData" rows="5" cols="60"/>
<br/>
- <button ng:click="selected.import(importData)">Import</button>
+ <button ng:click="selected.import_csv(Importdata)">Import</button>
</div>
</div>
</div>
View
2  app/controllers/sessions_controller.rb
@@ -3,7 +3,7 @@ def new
end
def create
- user = User.authenticate(params[:login], params[:password])
+ user = User.authenticate(params[:login].downcase, params[:password])
if user
session[:user_id] = user.id
redirect_to_target_or_default root_url, :notice => "Logged in successfully."
View
2  app/views/wallets/edit_dialog.html.erb
@@ -14,7 +14,7 @@
<label name="crypto">Encryption: </label>
<select name="crypto" ng:options="c for c in cryptos"></select>
<br/>
- <input type="submit" name="submit"/>
+ <input type="submit" name="submit" id="createButton"/>
<button ng:click="cancel()">Cancel</button>
</form>
</div>

No commit comments for this range

Something went wrong with that request. Please try again.