मुझे कामकाजी काम नहीं लग रहा है। मुझे यह त्रुटि मिल रही है: A hasher has not been provided for the user.
क्या किसी को पता है कि यह क्या होगा?उपयोगकर्ता के लिए एक हैशर प्रदान नहीं किया गया है
मैं ओएस एक्स 10.9 पर MAMP चल रहा हूँ। मैं php 5.4.4 का उपयोग कर रहा हूं MCrypt स्थापित और सक्षम है। यह त्रुटि तब होती है जब कोई नया उपयोगकर्ता बनाते समय पासवर्ड हैश करने का प्रयास करता है। हमारी परियोजना लार्वाले सेंट्री प्लगइन का उपयोग करती है।
<?php
use Auth, BaseController, Form, Input, Redirect, Sentry, View;
class AuthController extends BaseController {
public function register()
{
return View::make('Auth.register');
}
public function handleRegister()
{
$validator = Validator::make(Input::all(), User::$rules);
if ($validator->passes()) {
//The registration has passed, create a user
$user = new User;
$user->first_name = Input::get('first_name');
$user->last_name = Input::get('last_name');
$user->email = Input::get('email');
$user->password = Hash::make(Input::get('password'));
$user->activated = 1;
$user->save();
//grabbing the Sentry model of the user so we can save it to the appropriate group
$sentryUser = Sentry::findUserByLogin($user->email);
if (Input::get('userType') == 'Promoter')
{
$group = 'Promoters';
}
else
{
$group = 'Agents';
}
// Find the group using the group id
$group = Sentry::findGroupByName($group);
// Assign the group to the user
$sentryUser->addGroup($group);
return Redirect::action('[email protected]')->with('message', 'Thanks for registering!');
} else {
// validation has failed, display error messages
return Redirect::action('[email protected]')->with('message', 'The following errors occurred')->withErrors($validator)->withInput();
}
}
/**
* Display the login page
* @return View
*/
public function login()
{
return View::make('Auth.login');
}
/**
* Login action
* @return Redirect
*/
public function handleLogin()
{
$credentials = array(
'email' => Input::get('email'),
'password' => Input::get('password')
);
try
{
$user = Sentry::authenticate($credentials, false);
if ($user)
{
return Redirect::action('[email protected]');
}
}
catch(\Exception $e)
{
return Redirect::action('[email protected]')->withErrors(array('login' => $e->getMessage()));
}
}
/**
* Logout action
* @return Redirect
*/
public function logout()
{
Sentry::logout();
return Redirect::action('[email protected]')->with('message','You have been logged out');
}
}
?>
[Sentry2 उपयोगकर्ता मॉडल एक्सटेंशन] के संभावित डुप्लिकेट (http://stackoverflow.com/questions/16655070/sentry2-user-model-extension) – Ifnot