]> git.mxchange.org Git - friendica.git/commitdiff
[Database version 1394] Add 2fa_trusted_browser table
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 19 Jan 2021 04:27:44 +0000 (23:27 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sat, 23 Jan 2021 10:42:58 +0000 (05:42 -0500)
database.sql
static/dbstructure.config.php

index c9017fd2ef81230d2a0c986219d6d49739f5f930..4a8a9d6fc886e7d1cf154a6d3e05ec423295ebf1 100644 (file)
@@ -283,10 +283,24 @@ CREATE TABLE IF NOT EXISTS `2fa_recovery_codes` (
        `code` varchar(50) NOT NULL COMMENT 'Recovery code string',
        `generated` datetime NOT NULL COMMENT 'Datetime the code was generated',
        `used` datetime COMMENT 'Datetime the code was used',
-        PRIMARY KEY(`uid`,`code`),
+       PRIMARY KEY(`uid`,`code`),
        FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor authentication recovery codes';
 
+--
+-- TABLE 2fa_trusted_browser
+--
+CREATE TABLE IF NOT EXISTS `2fa_trusted_browser` (
+    `cookie_hash` varchar(80) NOT NULL COMMENT 'Trusted cookie hash',
+    `uid` mediumint unsigned NOT NULL COMMENT 'User ID',
+    `user_agent` text COMMENT 'User agent string',
+    `created` datetime NOT NULL COMMENT 'Datetime the trusted browser was recorded',
+    `last_used` datetime COMMENT 'Datetime the trusted browser was last used',
+    PRIMARY KEY(`cookie_hash`),
+    INDEX `uid` (`uid`),
+    FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
+) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Two-factor authentication trusted browsers';
+
 --
 -- TABLE addon
 --
index feba3c920b2682688255e1486d159ba4d1b4b980..5c9d454ead96db1599df88f40849563869fb5dfb 100644 (file)
@@ -348,6 +348,20 @@ return [
                        "PRIMARY" => ["uid", "code"]
                ]
        ],
+       "2fa_trusted_browser" => [
+               "comment" => "Two-factor authentication trusted browsers",
+               "fields" => [
+                       "cookie_hash" => ["type" => "varchar(80)", "not null" => "1", "primary" => "1", "comment" => "Trusted cookie hash"],
+                       "uid" => ["type" => "mediumint unsigned", "not null" => "1", "foreign" => ["user" => "uid"], "comment" => "User ID"],
+                       "user_agent" => ["type" => "text", "comment" => "User agent string"],
+                       "created" => ["type" => "datetime", "not null" => "1", "comment" => "Datetime the trusted browser was recorded"],
+                       "last_used" => ["type" => "datetime", "comment" => "Datetime the trusted browser was last used"],
+               ],
+               "indexes" => [
+                       "PRIMARY" => ["cookie_hash"],
+                       "uid" => ["uid"],
+               ]
+       ],
        "addon" => [
                "comment" => "registered addons",
                "fields" => [