Note that there are some explanatory texts on larger screens.

plurals
  1. POLaravel 4 failing Auth::attempt with Hash replacement
    primarykey
    data
    text
    <p>I'm trying to do authentication in a Laravel4 project, but it always fails.</p> <p>Since I'm only on PHP 5.3.4 I downloaded a replacement Hash package that uses SHA512 from <a href="https://github.com/robclancy/laravel4-hashing" rel="nofollow">https://github.com/robclancy/laravel4-hashing</a>.</p> <p>I already have a Users table (the Password field is pre-populated with SHA512 hashes, shared with another app) and my login auth method is:</p> <pre><code>Route::post('login', function() { $userdata = array( 'UserName' =&gt; 'SteB', 'password' =&gt; '1234' ); if (Auth::attempt($userdata, true)) { return Redirect::action('HomeController@Profile'); } else { return Redirect::to('/')-&gt;with('login_errors', true); } }); </code></pre> <p>I've also checked the SHA512 hash is correct using <a href="http://hash.online-convert.com/sha512-generator" rel="nofollow">http://hash.online-convert.com/sha512-generator</a></p> <p>This always fails (silently), any ideas why or how to debug it will be appreciated.</p> <p>My Users table is:</p> <p>UserID int, Identity PK<br> UserName varchar(24)<br> FullName varchar(32)<br> EMail varchar(64)<br> Password varchar(256)</p> <p>This is in an existing SQL Server 2000 database, I'm getting User info out of the DB for an un-authenticated page, so I know the DB driver and connection is working ok.</p> <p>User Model in Laravel:</p> <pre><code>use Illuminate\Auth\UserInterface; use Illuminate\Auth\Reminders\RemindableInterface; class User extends Eloquent implements UserInterface, RemindableInterface { /** * The database table used by the model. * * @var string */ protected $table = 'Users'; /** * The attributes excluded from the model's JSON form. * * @var array */ protected $hidden = array('password'); //protected $fillable = array('UserID', 'UserName', 'FullName'); /** * Get the unique identifier for the user. * * @return mixed */ public function getAuthIdentifier() { return $this-&gt;getKey(); } /** * Get the password for the user. * * @return string */ public function getAuthPassword() { /*Now all lowercase to match $userdata as suggested on SO*/ return $this-&gt;password; } /** * Get the e-mail address where password reminders are sent. * * @return string */ public function getReminderEmail() { return $this-&gt;EMail; } } </code></pre> <p><strong>UPDATE:</strong></p> <p>Just found this article: <a href="http://laravel.io/topic/20/hashing-in-laravel" rel="nofollow">http://laravel.io/topic/20/hashing-in-laravel</a>.<br> Looks like it's not doing things how I expected, a base64-encoded hash with random salt, I think.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload