本文整理汇总了PHP中Reminder::complete方法的典型用法代码示例。如果您正苦于以下问题:PHP Reminder::complete方法的具体用法?PHP Reminder::complete怎么用?PHP Reminder::complete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reminder
的用法示例。
在下文中一共展示了Reminder::complete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processReset
/**
* Handle posting of the form for the password reminder confirmation.
*
* @param int $id
* @param string $code
* @return \Illuminate\Http\RedirectResponse
*/
public function processReset($id, $code)
{
$rules = ['password' => 'required|confirmed'];
$validator = Validator::make(Input::get(), $rules);
if ($validator->fails()) {
return Redirect::back()->withInput()->withErrors($validator);
}
if (!($user = Sentinel::findById($id))) {
return Redirect::back()->withInput()->withErrors('The user no longer exists.');
}
try {
if (!Reminder::complete($user, $code, Input::get('password'))) {
return Redirect::route('user.login')->withErrors('Invalid or expired reset code.');
}
return Redirect::route('user.login')->withSuccess('Password was successfully resetted.');
} catch (NotUniquePasswordException $e) {
return Redirect::back()->withErrors($e->getMessage());
}
}
示例2: SetForgotPassword
/**
* Set the new password
* @return $this
*/
public function SetForgotPassword()
{
try {
$user = \Sentinel::getUserRepository()->findById(\Input::get('UserId'));
if (\Reminder::complete($user, \Input::get('ResetCode'), \Input::get('password'))) {
return redirect('auth/login')->withErrors(array('login' => 'Password reset successful. Please Login'));
} else {
return redirect('auth/forgotpassword')->withErrors(array('forgot_password' => 'Password reset failed'));
}
} catch (\Exception $e) {
return redirect('auth/forgotpassword')->withErrors(array('forgot_password' => 'User not found in our database.'));
}
}
示例3: postReset
public function postReset(Request $request)
{
$input = $request->all();
$credentials = ['email' => $request->email];
$rules = ['email' => 'required|email|exists:users,email', 'password' => 'required|alpha_num|min:6|max:20', 'password_confirm' => 'required|same:password', 'code' => 'required'];
$messsages = ['code.required' => 'خطای امنیتی. لطفا عملیات تغییر رمز عبور را مجددا انجام دهید.'];
$validator = Validator::make($input, $rules, $messsages);
if ($validator->fails()) {
return back()->withInput()->withErrors($validator);
}
if ($user = Sentinel::findByCredentials($credentials)) {
if (!Reminder::complete($user, $request->code, $request->password)) {
return redirect()->route('login')->with('fail', 'Invalid or expired reset code.');
}
return redirect()->route('login')->with('success', 'Password Reset.');
} else {
return back()->withInput()->with('fail', 'The user no longer exists.');
}
}
示例4: function
});
Route::get('reset/{id}/{code}', function ($id, $code) {
$user = Sentinel::findById($id);
return View::make('sentinel.reset.complete');
})->where('id', '\\d+');
Route::post('reset/{id}/{code}', function ($id, $code) {
$rules = ['password' => 'required|confirmed'];
$validator = Validator::make(Input::get(), $rules);
if ($validator->fails()) {
return Redirect::back()->withInput()->withErrors($validator);
}
$user = Sentinel::findById($id);
if (!$user) {
return Redirect::back()->withInput()->withErrors('The user no longer exists.');
}
if (!Reminder::complete($user, $code, Input::get('password'))) {
return Redirect::to('login')->withErrors('Invalid or expired reset code.');
}
return Redirect::to('login')->withSuccess("Password Reset.");
})->where('id', '\\d+');
Route::group(['prefix' => 'account', 'before' => 'auth'], function () {
Route::get('/', function () {
$user = Sentinel::getUser();
$persistence = Sentinel::getPersistenceRepository();
return View::make('sentinel.account.home', compact('user', 'persistence'));
});
Route::get('kill', function () {
$user = Sentinel::getUser();
Sentinel::getPersistenceRepository()->flush($user);
return Redirect::back();
});