Skip to content

Commit

Permalink
Show error if password is invalid - review
Browse files Browse the repository at this point in the history
  • Loading branch information
jayralencar committed Apr 26, 2016
1 parent 76a5739 commit 3c0fbcd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log
This change log is started in 0.3.2;

## 0.3.3 (2016-04-26)
- Show error if password is invalid - review

## 0.3.2 (2016-04-23)
- Show error if password is invalid
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"encrypt",
"decrypt"
],
"version": "0.3.2",
"version": "0.3.3",
"author": {
"name": "Jayr Alencar",
"email": "jayralencarpereira@gmail.com",
Expand Down
7 changes: 4 additions & 3 deletions sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ sqlite.prototype.connect = function(db, password, algorithm){
this.con(1);
}

try{
this.run("SELECT name FROM sqlite_master WHERE type = 'table'");
}catch(e){
var res = this.run("CREATE TABLE jayr(name TEXT)");
if(res.error){
throw "Invalid Password! Please check your password or database name.";
}else{
this.run("DROP TABLE jayr")
}

return this;
Expand Down

0 comments on commit 3c0fbcd

Please sign in to comment.