diff options
author | William Carroll <wpcarro@gmail.com> | 2020-07-28T20·33+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-07-28T20·33+0100 |
commit | cf6c8799ab86278c827d4236a7a89163c61c29b9 (patch) | |
tree | fe34a5b41f63a44ff961af2a85a27e625220291d /src/init.sql | |
parent | f051b0be0bc360c949b3b1913f13c4856ae317ca (diff) |
Restrict users from multiple failed login attempts
I'm not resetting the failed LoginAttempt count, which is a low priority for now, but necessary eventually.
Diffstat (limited to 'src/init.sql')
-rw-r--r-- | src/init.sql | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/init.sql b/src/init.sql index 1439bd338835..117a3bd06f90 100644 --- a/src/init.sql +++ b/src/init.sql @@ -9,6 +9,7 @@ BEGIN TRANSACTION; DROP TABLE IF EXISTS Accounts; DROP TABLE IF EXISTS Trips; DROP TABLE IF EXISTS Sessions; +DROP TABLE IF EXISTS LoginAttempts; CREATE TABLE Accounts ( -- TODO(wpcarro): Add CHECK(..) constraint @@ -38,4 +39,11 @@ CREATE TABLE Sessions ( FOREIGN KEY (username) REFERENCES Accounts ON DELETE CASCADE ); +CREATE TABLE LoginAttempts ( + username TEXT NOT NULL UNIQUE, + numAttempts INTEGER NOT NULL, + PRIMARY KEY (username), + FOREIGN KEY (username) REFERENCES Accounts ON DELETE CASCADE +); + COMMIT; |