注册登录改为json返回
This commit is contained in:
parent
19c4e9291c
commit
9417f09675
|
|
@ -31,12 +31,10 @@ class LoginController extends Controller
|
|||
{
|
||||
$credentials = $request->only('login');
|
||||
|
||||
if (auth(Customer::AUTH_GUARD)->attempt($credentials['login'])) {
|
||||
return redirect(shop_route('account.index'));
|
||||
if (!auth(Customer::AUTH_GUARD)->attempt($credentials['login'])) {
|
||||
throw new \Exception("账号密码错误!");
|
||||
}
|
||||
|
||||
return back()->withErrors([
|
||||
'email' => 'The provided credentials do not match our records.',
|
||||
]);
|
||||
json_success("登录成功!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,6 @@ class RegisterController extends Controller
|
|||
$data = $request->only('register.email', 'register.password');
|
||||
AccountService::register($data['register']);
|
||||
|
||||
return redirect(shop_route('login.index'))->with('success',"注册成功,您现在可以使用您的账号登录网站!");
|
||||
return json_success("注册成功,您现在可以使用您的账号登录网站!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue