예제 #1
0
 public function password(Request $request)
 {
     $rules = ['password' => 'required|min:6|max:20', 'new_password' => 'required|min:6|max:20|different:password', 'new_password2' => 'required|same:new_password'];
     $this->validate($request, $rules);
     $password = $request->get('password');
     $newPassword = $request->get('new_password');
     if (!Hash::check($password, $this->user->password)) {
         return redirect('/user/client/profile')->withErrors(['password' => 'Wrong current password']);
     }
     $this->user->password = bcrypt($newPassword);
     $this->user->save();
     NotificationMapper::notify($this->user, 'You changed your password');
     return redirect('/user/client/profile')->with('success', 'Your password was changed');
 }
예제 #2
0
 public static function referralAdded(User $user, User $referrer)
 {
     $title = '<a href="/profile/' . $user->id . '">' . $user->name . '</a> registered as your referral';
     NotificationMapper::notify($referrer, $title, 'money');
 }