Coder Social home page Coder Social logo

Comments (17)

jenssegers avatar jenssegers commented on June 12, 2024

Could you show some code? You can also email it if you prefer.

from laravel-mongodb.

craigward avatar craigward commented on June 12, 2024

Here is the model in question

<?php

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends MongoModel implements UserInterface, RemindableInterface {

/**
 * The database table used by the model.
 *
 * @var string
 */
protected $table = 'administrators';

/**
 * The attributes excluded from the model's JSON form.
 *
 * @var array
 */
protected $hidden = array('password');

/**
 * Get the unique identifier for the user.
 *
 * @return mixed
 */
public function getAuthIdentifier()
{
    return $this->getKey();
}

/**
 * Get the password for the user.
 *
 * @return string
 */
public function getAuthPassword()
{
    return $this->password;
}

/**
 * Get the e-mail address where password reminders are sent.
 *
 * @return string
 */
public function getReminderEmail()
{
    return $this->email;
}

}

I have an Alias set up for MongoModel. Its the standard User model that is shipped with laravel really

from laravel-mongodb.

jenssegers avatar jenssegers commented on June 12, 2024

I added the interfaces to the user model I use in the tests, but I did not get the error.

from laravel-mongodb.

craigward avatar craigward commented on June 12, 2024

How odd, I'll have a dig round and see if it could be anything else.

Thanks for looking

from laravel-mongodb.

craigward avatar craigward commented on June 12, 2024

In the Auth config file should I be using 'Eloquent' or 'database' as the driver?

If I use Eloquent I get a different error, which is: Trying to get property of non-object on line 109 of vendor/laravel/framework/src/Illuminate/Auth/Reminders/DatabaseReminderRepository.php

 $createdPlusHour = strtotime($reminder->created_at) + $this->expires; 

I think this is because the date is now an array which it is not expecting.

from laravel-mongodb.

RSully avatar RSully commented on June 12, 2024

For authentication I am using eloquent, and in my database config I have mongo setup as the default connection which Eloquent should use.

Edit: I haven't tested password resets yet

from laravel-mongodb.

craigward avatar craigward commented on June 12, 2024

The problem with using the Eloquent driver is its throws the error I wrote about above.

from laravel-mongodb.

craigward avatar craigward commented on June 12, 2024

I've added a question on Stack Overflow to see if I can get to the bottom of the issue. Once I do I'll post back here

http://stackoverflow.com/questions/18750824/laravel-and-mongodb-generating-must-implement-remindable-interface

from laravel-mongodb.

jenssegers avatar jenssegers commented on June 12, 2024

I will try it out in a laravel application to see if I get the same error.

from laravel-mongodb.

philipzaengle avatar philipzaengle commented on June 12, 2024

Running into this issue here as well, digging in unless someone has found a solution...

from laravel-mongodb.

jenssegers avatar jenssegers commented on June 12, 2024

What features are you guys using from Auth? I created a user and logged in using Auth::attempt and did not see any errors.

from laravel-mongodb.

philipzaengle avatar philipzaengle commented on June 12, 2024

The error I am experiencing is with Password::reset

from laravel-mongodb.

jenssegers avatar jenssegers commented on June 12, 2024

I'm not getting this error. This is the header of my user model:

<?php

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
use Jenssegers\Mongodb\Model as Eloquent;

class User extends Eloquent implements UserInterface, RemindableInterface {

Everything else remains unchanged. The auth driver is set (by default) to 'eloquent'.

from laravel-mongodb.

philipzaengle avatar philipzaengle commented on June 12, 2024

Are you using the standard password_reminders table (in this case a collection)? My issues are in the DatabaseReminderRepository class in namespace Illuminate\Auth\Reminders on line 110 there's a check to see if the reminder has expired, which is unable to perform due to the nature of the data being passed to it via $reminder->created_at.

Ugly core hack, change line 110:
$createdPlusHour = strtotime($reminder->created_at) + $this->expires;
to
$createdPlusHour = strtotime($reminder['created_at']['date'] + $reminder['created_at']['timezone']) + $this->expires;

from laravel-mongodb.

jenssegers avatar jenssegers commented on June 12, 2024

Oh, I was looking at line 216.

I don't really know how to fix the issue with the date object. @philipzaengle, could you try this for me:

$createdPlusHour = strtotime((string) $reminder->created_at) + $this->expires;

from laravel-mongodb.

jenssegers avatar jenssegers commented on June 12, 2024

Never mind, the toString method of the MongoDate class does not return a nice date string.

from laravel-mongodb.

jenssegers avatar jenssegers commented on June 12, 2024

I fixed the password reminder issue. Check out the Auth section in the readme: https://github.com/jenssegers/Laravel-MongoDB#auth

from laravel-mongodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.