From f672bd246e619044eed97b15cbb5cc4abe2e8428 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Fri, 11 Aug 2017 00:49:48 +0200 Subject: [PATCH] Increase rsstoken column to varchar(64) to accommodate new api key size --- Changelog | 2 ++ build/nntmux.xml | 4 ++-- nntmux/Users.php | 5 +++-- resources/db/patches/mysql/0315~users.sql | 3 +++ 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 resources/db/patches/mysql/0315~users.sql diff --git a/Changelog b/Changelog index 7ad6e8115..1e9fca36d 100755 --- a/Changelog +++ b/Changelog @@ -1,3 +1,5 @@ +2017-08-11 DariusIII + * Chg: Increase rsstoken column to varchar(64) to accommodate new api key size 2017-08-10 DariusIII * Chg: Use Hash facade for password management in Users class * Chg: Add customized 404 page diff --git a/build/nntmux.xml b/build/nntmux.xml index 03106a396..3c56ad7e4 100755 --- a/build/nntmux.xml +++ b/build/nntmux.xml @@ -16,8 +16,8 @@ - 314 - 314 + 315 + 315 diff --git a/nntmux/Users.php b/nntmux/Users.php index 5d32ac328..324142e0c 100755 --- a/nntmux/Users.php +++ b/nntmux/Users.php @@ -4,6 +4,7 @@ namespace nntmux; use App\Models\Settings; use App\Models\UserRequest; use Illuminate\Support\Facades\Hash; +use Illuminate\Support\Facades\Password; use nntmux\db\DB; use nntmux\utility\Utility; use App\Models\User; @@ -494,7 +495,7 @@ class Users */ public function updateRssKey($uid): int { - User::query()->where('id', $uid)->update(['rsstoken' => md5(uniqid('', true))]); + User::query()->where('id', $uid)->update(['rsstoken' => Password::getRepository()->createNewToken()]); return self::SUCCESS; } @@ -814,7 +815,7 @@ class Users $this->pdo->escapeString($email), $role, $this->pdo->escapeString((int)Settings::value('..storeuserips') === 1 ? $host : ''), - $this->pdo->escapeString(uniqid('', true)), + $this->pdo->escapeString(Password::getRepository()->createNewToken()), $invites, ((int)$invitedBy === 0 ? 'NULL' : $invitedBy), $this->pdo->escapeString($this->pdo->uuid()), diff --git a/resources/db/patches/mysql/0315~users.sql b/resources/db/patches/mysql/0315~users.sql new file mode 100644 index 000000000..5e0a8013b --- /dev/null +++ b/resources/db/patches/mysql/0315~users.sql @@ -0,0 +1,3 @@ +# Increase rsstoken column to varchar(64) to accommodate new api key size + +ALTER TABLE users CHANGE rsstoken rsstoken VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL; \ No newline at end of file