-
Notifications
You must be signed in to change notification settings - Fork 1.4k
When I try to reset my password I get this error: FatalThrowableError in Carbon.php line 291: Type error: DateTime::__construct() expects parameter 1 to be string, array given #1164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
i have the same problem. |
Same problem here with Laravel 5.4. How did you fix it? |
I wildlands send you the screenshot asap.
Il giorno ven 21 apr 2017 alle 18:07 JuCarr <[email protected]> ha
scritto:
… Same problem here with Laravel 5.4. How did you fix it?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1164 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZdiGERdHk07ZZmfnonWrRdV3XAdNVZHks5ryNRPgaJpZM4MrkiJ>
.
|
Will send*
Il giorno ven 21 apr 2017 alle 18:08 Alessandro Mazzari <
[email protected]> ha scritto:
… I wildlands send you the screenshot asap.
Il giorno ven 21 apr 2017 alle 18:07 JuCarr ***@***.***> ha
scritto:
> Same problem here with Laravel 5.4. How did you fix it?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#1164 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AZdiGERdHk07ZZmfnonWrRdV3XAdNVZHks5ryNRPgaJpZM4MrkiJ>
> .
>
|
Same problem here, any fixes for this? @jenssegers |
Guys i fixed this by adding those classes to the user model. `<?php namespace App; use Illuminate\Notifications\Notifiable; class User extends Eloquent implements Authenticatable, CanResetPasswordContract btw, i'm pretty sure that : Hope i helped you all. |
Same problem here, any fixes for this? @jenssegers |
As mentioned in the documentation, registering the service provider fixed my problem. |
see my fix/hack for laravel 5.4 based project - #1124 (comment) |
Getting same problem here also any updates on this? |
In Config/App.php replace Timezone: Europe/Moscow |
Wow thank you so much, this solves my problem. "jenssegers/mongodb": "^3.5", |
Adding only this solve the issue for me, great! |
for In Config/App.php replace Illuminate\Auth\Passwords\PasswordResetServiceProvider on Jenssegers\Mongodb\Auth\PasswordResetServiceProvider Important: dont forget to clean the password_resets table in your database before testing. |
after once "forgot password" work fine but after twice "forgot password" on one user not work and error is : |
ok i am change carbon on |
Yeah, thanks. I thought I was stupid. Because everything was configured correctly, but there was still an old data set in the collection. |
Okay, happy too early. If i run a second password reset call for the same email i got this Error.
|
Please write steps for reproducing |
Run
First: passwords.sent |
I also overload the <?php
namespace Jenssegers\Mongodb\Auth;
use DateTime;
use DateTimeZone;
use Illuminate\Auth\Passwords\DatabaseTokenRepository as BaseDatabaseTokenRepository;
use MongoDB\BSON\UTCDateTime;
class DatabaseTokenRepository extends BaseDatabaseTokenRepository
{
/**
* @inheritdoc
*/
protected function getPayload($email, $token)
{
return [
'email' => $email,
'token' => $this->hasher->make($token),
'created_at' => new UTCDateTime(time() * 1000),
];
}
/**
* @inheritdoc
*/
protected function tokenExpired($createdAt)
{
return parent::tokenExpired(
$this->convertDateToString($createdAt)
);
}
/**
* @inheritdoc
*/
protected function tokenRecentlyCreated($createdAt)
{
return parent::tokenRecentlyCreated(
$this->convertDateToString($createdAt)
);
}
/**
* Convert UTCDateTime to a date string
*
* @param mixed $date
* @return mixed
*/
private function convertDateToString($date)
{
if ($date instanceof UTCDateTime) {
$date = $date->toDateTime();
$date->setTimezone(new DateTimeZone(date_default_timezone_get()));
$createdAt = $date->format('Y-m-d H:i:s');
} elseif (is_array($date) && isset($date['date'])) {
$date = new DateTime($date['date'], new DateTimeZone(isset($date['timezone']) ? $date['timezone'] : 'UTC'));
$date->setTimezone(new DateTimeZone(date_default_timezone_get()));
$date = $date->format('Y-m-d H:i:s');
}
return $date;
}
} |
@Smolevich i created a fork of your demo project with a basic setup of the issue above for testing run |
@jannnnnn i check it now |
@jannnnnn After running command i catch error |
You have to set |
Hello guys,
every time I try to reset my psw I get this error.
Using Laravel with MongoDB:
Thanks in advance for the answers
in Carbon.php line 291 at DateTime->__construct(array('date' => '2017-03-28 12:45:33.000000', 'timezone_type' => '3', 'timezone' => 'UTC'), object(DateTimeZone)) in Carbon.php line 291 at Carbon->__construct(array('date' => '2017-03-28 12:45:33.000000', 'timezone_type' => '3', 'timezone' => 'UTC'), null) in Carbon.php line 324 at Carbon::parse(array('date' => '2017-03-28 12:45:33.000000', 'timezone_type' => '3', 'timezone' => 'UTC')) in DatabaseTokenRepository.php line 126 at DatabaseTokenRepository->tokenExpired(array('_id' => object(ObjectID), 'email' => '[email protected]', 'token' => 'c1b01664ea63f3a7e2a745c29568cb4f595d8af7be19dd20baed8993096375f4', 'created_at' => array('date' => '2017-03-28 12:45:33.000000', 'timezone_type' => '3', 'timezone' => 'UTC'))) in DatabaseTokenRepository.php line 115 at DatabaseTokenRepository->exists(object(User), array('_id' => object(ObjectID), 'email' => '[email protected]', 'token' => 'c1b01664ea63f3a7e2a745c29568cb4f595d8af7be19dd20baed8993096375f4', 'created_at' => array('date' => '2017-03-28 12:45:33.000000', 'timezone_type' => '3', 'timezone' => 'UTC'))) in PasswordBroker.php line 122 at PasswordBroker->validateReset(array('email' => '[email protected]', 'password' => 'Alessaalessa656', 'password_confirmation' => 'Alessaalessa656', 'token' => 'c1b01664ea63f3a7e2a745c29568cb4f595d8af7be19dd20baed8993096375f4')) in PasswordBroker.php line 88 at PasswordBroker->reset(array('email' => '[email protected]', 'password' => 'Alessaalessa656', 'password_confirmation' => 'Alessaalessa656', 'token' => 'c1b01664ea63f3a7e2a745c29568cb4f595d8af7be19dd20baed8993096375f4'), object(Closure)) in ResetsPasswords.php line 46 at ResetPasswordController->reset(object(Request)) at call_user_func_array(array(object(ResetPasswordController), 'reset'), array(object(Request))) in Controller.php line 55 at Controller->callAction('reset', array(object(Request))) in ControllerDispatcher.php line 44 at ControllerDispatcher->dispatch(object(Route), object(ResetPasswordController), 'reset') in Route.php line 189 at Route->runController() in Route.php line 144 at Route->run(object(Request)) in Router.php line 653 at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 53 at Pipeline->Illuminate\Routing\{closure}(object(Request)) in RedirectIfAuthenticated.php line 24 at RedirectIfAuthenticated->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41 at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 65 at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49 at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64 at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37 at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59 at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104 at Pipeline->then(object(Closure)) in Router.php line 655 at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 629 at Router->dispatchToRoute(object(Request)) in Router.php line 607 at Router->dispatch(object(Request)) in Kernel.php line 268 at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53 at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104 at Pipeline->then(object(Closure)) in Kernel.php line 150 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 117 at Kernel->handle(object(Request)) in index.php line 53 at require('/Users/alessandro/Documents/Programmazione/Laravel/ASAP/public/index.php') in server.php line 133
The text was updated successfully, but these errors were encountered: