public function passwordChange() { $oldPassword = Input::get('old_password'); $newPassword = Input::get('new_password'); if (!empty($oldPassword) && !empty($newPassword)) { $userId = Authorizer::getResourceOwnerId(); $user = User::find($userId); if (!empty($user)) { if (\Auth::validate(['email' => $user->email, 'password' => $oldPassword])) { $user->password = \Hash::make($newPassword); $user->save(); return Response::json("OK", 200); } } } return Response::json("Error", 400); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ public function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt(md5($data['password']))]); }