summaryrefslogtreecommitdiff
path: root/app/Schema
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-01-09 17:28:31 -0500
committerFrederic Guillot <fred@kanboard.net>2016-01-09 17:28:31 -0500
commit26e3996014936268f4acbfa214fa881af9320ddd (patch)
tree5f7fa2c1b73e4443ce75e8919383bdf775492304 /app/Schema
parent03032c3190a27408d60e27f486a4ca472448e9dc (diff)
Add forgot password feature
Diffstat (limited to 'app/Schema')
-rw-r--r--app/Schema/Mysql.php24
-rw-r--r--app/Schema/Postgres.php24
-rw-r--r--app/Schema/Sqlite.php20
3 files changed, 61 insertions, 7 deletions
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php
index b42e9661..c98e083e 100644
--- a/app/Schema/Mysql.php
+++ b/app/Schema/Mysql.php
@@ -6,7 +6,25 @@ use PDO;
use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
-const VERSION = 100;
+const VERSION = 101;
+
+function version_101(PDO $pdo)
+{
+ $pdo->exec("
+ CREATE TABLE password_reset (
+ token VARCHAR(80) PRIMARY KEY,
+ user_id INT NOT NULL,
+ date_expiration INT NOT NULL,
+ date_creation INT NOT NULL,
+ ip VARCHAR(45) NOT NULL,
+ user_agent VARCHAR(255) NOT NULL,
+ is_active TINYINT(1) NOT NULL,
+ FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
+ ) ENGINE=InnoDB CHARSET=utf8
+ ");
+
+ $pdo->exec("INSERT INTO settings VALUES ('password_reset', '1')");
+}
function version_100(PDO $pdo)
{
@@ -1063,7 +1081,7 @@ function version_12(PDO $pdo)
CREATE TABLE remember_me (
id INT NOT NULL AUTO_INCREMENT,
user_id INT,
- ip VARCHAR(40),
+ ip VARCHAR(45),
user_agent VARCHAR(255),
token VARCHAR(255),
sequence VARCHAR(255),
@@ -1079,7 +1097,7 @@ function version_12(PDO $pdo)
id INT NOT NULL AUTO_INCREMENT,
auth_type VARCHAR(25),
user_id INT,
- ip VARCHAR(40),
+ ip VARCHAR(45),
user_agent VARCHAR(255),
date_creation INT,
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index 65128eb5..961d8f4d 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -6,7 +6,25 @@ use PDO;
use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
-const VERSION = 80;
+const VERSION = 81;
+
+function version_81(PDO $pdo)
+{
+ $pdo->exec("
+ CREATE TABLE password_reset (
+ token VARCHAR(80) PRIMARY KEY,
+ user_id INTEGER NOT NULL,
+ date_expiration INTEGER NOT NULL,
+ date_creation INTEGER NOT NULL,
+ ip VARCHAR(45) NOT NULL,
+ user_agent VARCHAR(255) NOT NULL,
+ is_active BOOLEAN NOT NULL,
+ FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
+ )
+ ");
+
+ $pdo->exec("INSERT INTO settings VALUES ('password_reset', '1')");
+}
function version_80(PDO $pdo)
{
@@ -983,7 +1001,7 @@ function version_1(PDO $pdo)
CREATE TABLE remember_me (
id SERIAL PRIMARY KEY,
user_id INTEGER,
- ip VARCHAR(40),
+ ip VARCHAR(45),
user_agent VARCHAR(255),
token VARCHAR(255),
sequence VARCHAR(255),
@@ -996,7 +1014,7 @@ function version_1(PDO $pdo)
id SERIAL PRIMARY KEY,
auth_type VARCHAR(25),
user_id INTEGER,
- ip VARCHAR(40),
+ ip VARCHAR(45),
user_agent VARCHAR(255),
date_creation INTEGER,
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php
index f430c00b..f1be0cf1 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -6,7 +6,25 @@ use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
use PDO;
-const VERSION = 92;
+const VERSION = 93;
+
+function version_93(PDO $pdo)
+{
+ $pdo->exec("
+ CREATE TABLE password_reset (
+ token TEXT PRIMARY KEY,
+ user_id INTEGER NOT NULL,
+ date_expiration INTEGER NOT NULL,
+ date_creation INTEGER NOT NULL,
+ ip TEXT NOT NULL,
+ user_agent TEXT NOT NULL,
+ is_active INTEGER NOT NULL,
+ FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
+ )
+ ");
+
+ $pdo->exec("INSERT INTO settings VALUES ('password_reset', '1')");
+}
function version_92(PDO $pdo)
{