use Request::ip() instead

This commit is contained in:
printempw 2016-12-16 22:20:41 +08:00
parent 28a66cba18
commit efd57bfce0
3 changed files with 4 additions and 8 deletions

View File

@ -161,8 +161,6 @@ class AdminController extends Controller
'enabled' => $plugins->getEnabledPlugins()
];
// dd($data);
return view('admin.plugins', $data);
}

View File

@ -115,11 +115,9 @@ class AuthController extends Controller
return json(trans('auth.register.close'), 7);
}
$ip = get_real_ip();
// If amount of registered accounts of IP is more than allowed amounts,
// then reject the register.
if (User::where('ip', $ip)->count() < option('regs_per_ip'))
if (User::where('ip', $request->ip())->count() < option('regs_per_ip'))
{
// Register a new user.
// If the email is already registered,
@ -127,9 +125,9 @@ class AuthController extends Controller
$user = User::register(
$request->input('email'),
$request->input('password'),
function($user) use ($ip, $request)
function($user) use ($request)
{
$user->ip = $ip;
$user->ip = $request->ip();
$user->score = option('user_initial_score');
$user->register_at = Utils::getTimeFormatted();
$user->last_sign_at = Utils::getTimeFormatted(time() - 86400);

View File

@ -106,7 +106,7 @@ class SetupController extends Controller
$request->input('password'),
function ($user)
{
$user->ip = get_real_ip();
$user->ip = $request->ip();
$user->score = option('user_initial_score');
$user->register_at = Utils::getTimeFormatted();
$user->last_sign_at = Utils::getTimeFormatted(time() - 86400);