Skip to content
This repository has been archived by the owner on Jul 10, 2019. It is now read-only.

Auth always returns False #31

Closed
leankarlo opened this issue Apr 25, 2014 · 5 comments
Closed

Auth always returns False #31

leankarlo opened this issue Apr 25, 2014 · 5 comments

Comments

@leankarlo
Copy link

Hi

How come it always returns false. below are my code.

auth.php

array( 'patient' => array( 'driver' => 'database', 'table' => 'patients' ), 'doctor' => array( 'driver' => 'database', 'table' => 'doctors' ) ), 'reminder' => array( 'email' => 'emails.auth.reminder', 'table' => 'password_reminders', 'expire' => 60, ), ); # LoginController.php $userdata = array( 'email' => $input['Email'], 'password' => $input['Password'], ); if (Auth::patient()->attempt($userdata,true)) { $view = Redirect::to('patients'); return $view; } else { return Redirect::to('/')->withErrors('Incorrect Email or Password')->withInput(); } # app.php 'providers' => array( ``` 'Illuminate\Foundation\Providers\ArtisanServiceProvider', //'Illuminate\Auth\AuthServiceProvider', 'Ollieread\Multiauth\MultiauthServiceProvider', 'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Session\CommandsServiceProvider', 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 'Illuminate\Routing\ControllerServiceProvider', 'Illuminate\Cookie\CookieServiceProvider', 'Illuminate\Database\DatabaseServiceProvider', 'Illuminate\Encryption\EncryptionServiceProvider', 'Illuminate\Filesystem\FilesystemServiceProvider', 'Illuminate\Hashing\HashServiceProvider', 'Illuminate\Html\HtmlServiceProvider', 'Illuminate\Log\LogServiceProvider', 'Illuminate\Mail\MailServiceProvider', 'Illuminate\Database\MigrationServiceProvider', 'Illuminate\Pagination\PaginationServiceProvider', 'Illuminate\Queue\QueueServiceProvider', 'Illuminate\Redis\RedisServiceProvider', 'Illuminate\Remote\RemoteServiceProvider', 'Illuminate\Auth\Reminders\ReminderServiceProvider', 'Illuminate\Database\SeedServiceProvider', 'Illuminate\Session\SessionServiceProvider', 'Illuminate\Translation\TranslationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'Illuminate\Workbench\WorkbenchServiceProvider', ), ```
@leankarlo
Copy link
Author

here is my model

@leankarlo
Copy link
Author

never mind I saw my mistake. I used varchar55

@karborator
Copy link

How to solve this problem ?

config/app.php


'providers' => array(

    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    "Ollieread\Multiauth\MultiauthServiceProvider",
    'Illuminate\Cache\CacheServiceProvider',
    'Illuminate\Session\CommandsServiceProvider',
    'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
    'Illuminate\Routing\ControllerServiceProvider',
    'Illuminate\Cookie\CookieServiceProvider',
    'Illuminate\Database\DatabaseServiceProvider',
    'Illuminate\Encryption\EncryptionServiceProvider',
    'Illuminate\Filesystem\FilesystemServiceProvider',
    'Illuminate\Hashing\HashServiceProvider',
    'Illuminate\Html\HtmlServiceProvider',
    'Illuminate\Log\LogServiceProvider',
    'Illuminate\Mail\MailServiceProvider',
    'Illuminate\Database\MigrationServiceProvider',
    'Illuminate\Pagination\PaginationServiceProvider',
    'Illuminate\Queue\QueueServiceProvider',
    'Illuminate\Redis\RedisServiceProvider',
    'Illuminate\Remote\RemoteServiceProvider',      
    'Illuminate\Database\SeedServiceProvider',
    'Illuminate\Session\SessionServiceProvider',
    'Illuminate\Translation\TranslationServiceProvider',
    'Illuminate\Validation\ValidationServiceProvider',
    'Illuminate\View\ViewServiceProvider',
    'Illuminate\Workbench\WorkbenchServiceProvider',

),

config/auth.php

return array(
'multi' => array(
'account' => array(
'driver' => 'eloquent',
'model' => 'Admin'
),
'admin' => array(
'driver' => 'database',
'table' => 'admin'
)
)
);

controller
_---------------
Auth::account()->attempt(array(
'username' => $attributes['username'],
'password' => $attributes['password'],
));
Auth::admin()->attempt(array(
'username' => $attributes['username'],
'password' => $attributes['password'],
));
$a = Auth::account()->check();
$b = Auth::admin()->check();
var_dump($b);
exit;

ALWAYS FLASE ...

@leankarlo
Copy link
Author

I solve this by changing the size of the db password character.
I initially inputed varchar(55) instead of varchar (255)

Lean Karlo U. Corpuz
+63 2 9178625511
leankarlo_21@yahoo.com | leankarlo@gmail.com
2399 Belarmino St. Brgy Bangkal Makati City
Follow me on:

@karborator
Copy link

Hello Karlo,
I try to change the size of password and username but still returning false

2014-07-24 18:21 GMT+03:00 Lean Karlo Corpuz notifications@github.com:

I solve this by changing the size of the db password character.
I initially inputed varchar(55) instead of varchar (255)

Lean Karlo U. Corpuz
+63 2 9178625511
leankarlo_21@yahoo.com | leankarlo@gmail.com
2399 Belarmino St. Brgy Bangkal Makati City
Follow me on:


Reply to this email directly or view it on GitHub
#31 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants