Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8590465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:18:01+00:00 2026-06-11T23:18:01+00:00

When trying to use Laravel’s Auth class, I see that it always fails because

  • 0

When trying to use Laravel’s Auth class, I see that it always fails because (AFAIK) the attempt() method is only trying to select the username:

string(55) "SELECT * FROM `mdl_user` WHERE (`username` = ?) LIMIT 1"

(That’s outputted via Event::listen(‘laravel.eloquent’))

I’m using Eloquent as the driver, the table fields are ‘username’ and ‘password’, and my model (Moodle_User, located at models/moodle/user.php) is written like this:

class Moodle_User extends Eloquent {
    public static $table        = 'user';
    public static $connection   = 'moodle';
}

If I use the model as-is, it works flawlessly:

// returns the correct object
$user = Moodle_User::where('username', $username)->where('password', md5($password))->get(); 

Also, I’m not using the Hash class because Moodle currently uses MD5, so I call Auth::attempt() like this:

Auth::attempt(array('username' => $username, 'password' => md5($password)))

But it always returns false. If I do the exact same thing via the Moodle_User model, it works as expected.

Why does it ALWAYS return false?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:18:02+00:00Added an answer on June 11, 2026 at 11:18 pm

    You’re suppose to use Hash::make() not md5() to hash your passwords.

    http://laravel.asia/p/laravel-authentication

    I’d suggest you use your own driver because attempt in the eloquent driver and fluent driver uses Hash::check():

    https://github.com/laravel/laravel/blob/master/laravel/auth/drivers/eloquent.php#L53

    https://github.com/laravel/laravel/blob/master/laravel/auth/drivers/fluent.php#L41

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

trying to use the preferred on method call but the code is not working
I am trying use filehelpers class builder but I am kinda confused on what
I'm trying use the Sum method in a lambda expression for a comparison, but
I'm trying use eco for client-side templating. I have multiple .eco templates that I'd
I am trying use a from a multi-dimensional array that I create in another
I have a regex that I'm trying use to validate against strings. Trying to
I have a 3rd party DLL that I am trying to use in a
I am trying use the jQuery table sorter plugin for a table that is
Trying to use an excpetion class which could provide location reference for XML parsing,
I'm trying use jquery ui tabs together with js and mvc3. <div class=demo> <div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.