-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecates numbers and renames it to digits
- Loading branch information
Showing
8 changed files
with
89 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -350,7 +350,7 @@ Login: [email protected] | |
Lowercase: true | ||
Uppercase: true | ||
Symbols: true | ||
Numbers: true | ||
Digits: true | ||
Length: 16 | ||
Couter: 1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
DROP INDEX IF EXISTS passwords_unique; | ||
|
||
CREATE TABLE IF NOT EXISTS passwords_migration ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, | ||
login TEXT NOT NULL, | ||
site TEXT NOT NULL, | ||
uppercase BOOLEAN NOT NULL DEFAULT TRUE, | ||
symbols BOOLEAN NOT NULL DEFAULT TRUE, | ||
lowercase BOOLEAN NOT NULL DEFAULT TRUE, | ||
numbers BOOLEAN NOT NULL DEFAULT TRUE, | ||
counter INTEGER NOT NULL DEFAULT 1, | ||
version INTEGER NOT NULL DEFAULT 2, | ||
length INTEGER NOT NULL DEFAULT 16, | ||
created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
modified DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
); | ||
INSERT INTO passwords_migration ( | ||
id, | ||
user_id, | ||
login, | ||
site, | ||
uppercase, | ||
symbols, | ||
lowercase, | ||
numbers, | ||
counter, | ||
version, | ||
length, | ||
created, | ||
modified | ||
) SELECT id, user_id, login, site, uppercase, symbols, lowercase, digits, counter, version, length, created, modified FROM passwords; | ||
DROP TABLE passwords; | ||
ALTER TABLE passwords_migration RENAME TO passwords; | ||
|
||
CREATE UNIQUE INDEX IF NOT EXISTS passwords_unique ON passwords (user_id, login, site); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
DROP INDEX IF EXISTS passwords_unique; | ||
|
||
CREATE TABLE IF NOT EXISTS passwords_migration ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE, | ||
login TEXT NOT NULL, | ||
site TEXT NOT NULL, | ||
uppercase BOOLEAN NOT NULL DEFAULT TRUE, | ||
symbols BOOLEAN NOT NULL DEFAULT TRUE, | ||
lowercase BOOLEAN NOT NULL DEFAULT TRUE, | ||
digits BOOLEAN NOT NULL DEFAULT TRUE, | ||
counter INTEGER NOT NULL DEFAULT 1, | ||
version INTEGER NOT NULL DEFAULT 2, | ||
length INTEGER NOT NULL DEFAULT 16, | ||
created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
modified DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
); | ||
INSERT INTO passwords_migration ( | ||
id, | ||
user_id, | ||
login, | ||
site, | ||
uppercase, | ||
symbols, | ||
lowercase, | ||
digits, | ||
counter, | ||
version, | ||
length, | ||
created, | ||
modified | ||
) SELECT id, user_id, login, site, uppercase, symbols, lowercase, numbers, counter, version, length, created, modified FROM passwords; | ||
DROP TABLE passwords; | ||
ALTER TABLE passwords_migration RENAME TO passwords; | ||
|
||
CREATE UNIQUE INDEX IF NOT EXISTS passwords_unique ON passwords (user_id, login, site); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,17 +134,17 @@ mod tests { | |
client.post("/passwords") | ||
.header(ContentType::JSON) | ||
.header(Header::new("authorization", format!("bearer {}", token.access))) | ||
.body(r#"{"login":"[email protected]","site":"rockpass.sample","uppercase":true,"symbols":true,"lowercase":true,"numbers":true,"counter":1,"version":2,"length":16}"#) | ||
.body(r#"{"login":"[email protected]","site":"rockpass.sample","uppercase":true,"symbols":true,"lowercase":true,"digits":true,"counter":1,"version":2,"length":16}"#) | ||
.dispatch().await; | ||
client.post("/passwords") | ||
.header(ContentType::JSON) | ||
.header(Header::new("authorization", format!("bearer {}", token.access))) | ||
.body(r#"{"login":"[email protected]","site":"subsite.rockpass.sample","uppercase":true,"symbols":false,"lowercase":true,"numbers":true,"counter":2,"version":2,"length":16}"#) | ||
.body(r#"{"login":"[email protected]","site":"subsite.rockpass.sample","uppercase":true,"symbols":false,"lowercase":true,"digits":true,"counter":2,"version":2,"length":16}"#) | ||
.dispatch().await; | ||
client.post("/passwords") | ||
.header(ContentType::JSON) | ||
.header(Header::new("authorization", format!("bearer {}", token.access))) | ||
.body(r#"{"login":"[email protected]","site":"other.rockpass.sample","uppercase":true,"symbols":false,"lowercase":true,"numbers":false,"counter":1,"version":2,"length":8}"#) | ||
.body(r#"{"login":"[email protected]","site":"other.rockpass.sample","uppercase":true,"symbols":false,"lowercase":true,"digits":false,"counter":1,"version":2,"length":8}"#) | ||
.dispatch().await; | ||
} | ||
|
||
|
@@ -401,7 +401,7 @@ mod tests { | |
let request = client.put("/passwords/100") | ||
.header(ContentType::JSON) | ||
.header(Header::new("authorization", format!("bearer {}", token.access))) | ||
.body(r#"{"login":"[email protected]","site":"rockpass.sample","uppercase":true,"symbols":true,"lowercase":true,"numbers":true,"counter":1,"version":2,"length":16}"#); | ||
.body(r#"{"login":"[email protected]","site":"rockpass.sample","uppercase":true,"symbols":true,"lowercase":true,"digits":true,"counter":1,"version":2,"length":16}"#); | ||
let response = request.dispatch().await; | ||
assert_eq!(response.status(), Status::InternalServerError); | ||
// Check that the password to be changed has the following default values | ||
|
@@ -418,7 +418,7 @@ mod tests { | |
let request = client.put("/passwords/1") | ||
.header(ContentType::JSON) | ||
.header(Header::new("authorization", format!("bearer {}", token.access))) | ||
.body(r#"{"login":"[email protected]","site":"rockpass.sample","uppercase":false,"symbols":true,"lowercase":true,"numbers":true,"counter":2,"version":2,"length":16}"#); | ||
.body(r#"{"login":"[email protected]","site":"rockpass.sample","uppercase":false,"symbols":true,"lowercase":true,"digits":true,"counter":2,"version":2,"length":16}"#); | ||
let response = request.dispatch().await; | ||
assert_eq!(response.status(), Status::Created); | ||
assert_eq!(response.into_string().await.unwrap(), r#"{"detail":"Updated password entry for site rockpass.sample"}"#); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters