public function profile() { $userInfo = Auth::user(); if (Request::isMethod('post')) { $id = Auth::user()->id; if (User::checkUserPassword($id, Input::get('password')) == true) { $msgType = 'error'; $message = 'Password has been used before. <br /> Change your password at least 5 times before using this password again.'; return Redirect::action('user.profile')->with($msgType, $message); } $user = User::where('id', $id)->find($id); $user->password = Hash::make(Input::get('password')); $user->last_password_change = new DateTime(); $settingsExpiry = Settings::getSettingValue('password_expiry'); $user->password_expiration_date = User::userPasswordExpiry(date("Y-m-d H:i:s"), $settingsExpiry); $passwords = json_decode($user->passwords, true); if (sizeof($passwords) == 0) { $temp = array(); $temp[] = Hash::make(Input::get('password')); $user->passwords = json_encode($temp); } else { array_push($passwords, Hash::make(Input::get('password'))); if (sizeof($passwords) > 5) { array_shift($passwords); } $user->passwords = json_encode($passwords); } if ($user->save()) { $msgType = 'success'; $message = 'Password has been changed'; } else { $msgType = 'error'; $message = 'Password has been failed'; } return Redirect::action('user.profile')->with($msgType, $message); } else { $title = Lang::get('My Profile'); return View::make('user/profile', array('userInfo' => $userInfo, 'title' => $title)); } }
if (Hash::check('gl0b33st4t3', $user->password)) { $msgType = 'warning'; $message = 'Your password has been reset. Please change your password'; return Redirect::action('user.profile')->with($msgType, $message); } } else { $errorMsg = 'Please login using your credentials'; return Redirect::action('login.index')->with('error', $errorMsg); } }); Route::filter('password_expiry', function () { if (Auth::check()) { $date = date("Y-m-d H:i:s"); $user = Auth::user(); $settingsExpiry = Settings::getSettingValue('password_expiry'); $expirationDate = User::userPasswordExpiry($user->password_expiration_date, $settingsExpiry); if (strtotime($expirationDate) < strtotime($date)) { $msgType = 'warning'; $message = 'Your password has been expired. Please change your password.'; return Redirect::action('user.profile')->with($msgType, $message); } } else { $errorMsg = 'Please login using your credentials'; return Redirect::action('login.index')->with('error', $errorMsg); } }); Route::filter('check_merchant', function () { if (Auth::check()) { $userMember = UserMember::with('group')->where('user_id', Auth::user()->id)->get(); if ($userMember->count() > 0) { $fetch = array_fetch($userMember->toArray(), 'group.name');