/**
  * Pengaturan ganti password.
  *
  * @return string
  */
 public function gantiPass(Request $request, $id)
 {
     if (Auth::check()) {
         $id = Auth::user()->id_karyawan;
         $pass = Auth::user()->password;
         $newPass = \Input::get('newPass');
         $konfirm = \Input::get('confirmPass');
         if (\Hash::check(\Input::get('oldPass'), $pass)) {
             $profile = loginModel::find($id);
             $profile->password = bcrypt($newPass);
             $profile->save();
             return \Redirect::to('dashboard');
         } else {
             return \Redirect::to('pengaturan');
         }
         if ($newPass != $konfirm) {
             return \Redirect::to('pengaturan');
         } else {
             $profile = loginModel::find($id);
             $profile->password = bcrypt($newPass);
             $profile->save();
             return \Redirect::to('pengaturan');
         }
     } else {
         return \Redirect::to('login');
     }
 }
示例#2
0
 /**
  * .
  *
  * @return string
  */
 public function gantiPass(Request $request, $id)
 {
     if (Auth::check()) {
         $id = Auth::user()->id_karyawan;
         $pass = Auth::user()->password;
         $newPass = \Input::get('newPass');
         $konfirm = \Input::get('confirmPass');
         if (\Hash::check(\Input::get('oldPass'), $pass)) {
             $profile = loginModel::find($id);
             $profile->password = bcrypt($newPass);
             $profile->save();
             \DB::table('logs')->insert(['id_karyawan' => Auth::user()->id_karyawan, 'content' => Auth::user()->username . ' melukukan ganti password', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
             return \Redirect::to('dashboard');
         } else {
             return \Redirect::to('pengaturan');
         }
         if ($newPass != $konfirm) {
             return \Redirect::to('pengaturan');
         } else {
             $profile = loginModel::find($id);
             $profile->password = bcrypt($newPass);
             $profile->save();
             \DB::table('logs')->insert(['id_karyawan' => Auth::user()->id_karyawan, 'content' => Auth::user()->username . ' melukukan ganti password', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
             return \Redirect::to('pengaturan');
         }
     } else {
         return \Redirect::to('login');
     }
 }