Skip to content

Commit cb76758

Browse files
committed
Decode app key if it is encoded with base64
app key can be encoded in base64 in that case it should be decoded before using it as hash key to create password reset token. Fix #13269
1 parent 2095048 commit cb76758

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Illuminate/Auth/Passwords/PasswordBrokerManager.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use InvalidArgumentException;
66
use Illuminate\Contracts\Auth\PasswordBrokerFactory as FactoryContract;
7+
use Illuminate\Support\Str;
78

89
class PasswordBrokerManager implements FactoryContract
910
{
@@ -82,10 +83,15 @@ protected function resolve($name)
8283
*/
8384
protected function createTokenRepository(array $config)
8485
{
86+
$hashKey = $this->app['config']['app.key'];
87+
if (Str::startsWith($hashKey, 'base64:')) {
88+
$hashKey = base64_decode(substr($hashKey, 7));
89+
}
90+
8591
return new DatabaseTokenRepository(
8692
$this->app['db']->connection(),
8793
$config['table'],
88-
$this->app['config']['app.key'],
94+
$hashKey,
8995
$config['expire']
9096
);
9197
}

0 commit comments

Comments
 (0)