mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
update
This commit is contained in:
parent
3096b28076
commit
fe2f9c44a1
@ -33,4 +33,23 @@ class LoginController extends Controller
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function token2Login ($request) {
|
||||
if (empty($request->input('token'))) {
|
||||
abort(500, '参数错误');
|
||||
}
|
||||
$user = User::where('token', $request->input('token'))->first();
|
||||
if ($user) {
|
||||
$request->session()->put('email', $user->email);
|
||||
$request->session()->put('id', $user->id);
|
||||
if ($user->is_admin) {
|
||||
$request->session()->put('is_admin', true);
|
||||
}
|
||||
}
|
||||
$location = url('/#/' . $request->input('redirect') ? $request->input('redirect') : 'dashboard');
|
||||
if (config('v2board.app_url')) {
|
||||
$location = config('v2board.app_url') . $request->input('redirect') ? $request->input('redirect') : 'dashboard';
|
||||
}
|
||||
header('Location:' . config('v2board.app_url') . '/#/dashboard');
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ Route::prefix('v1')
|
||||
Route::post('sendEmailVerify', 'Passport\\CommController@sendEmailVerify');
|
||||
// Login
|
||||
Route::post('login', 'Passport\\LoginController@index');
|
||||
Route::get ('token2Login', 'Passport\\LoginController@token2Login');
|
||||
// Forget
|
||||
Route::post('forget', 'Passport\\ForgetController@index');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user