登录页面相关多语言

This commit is contained in:
Edward Yang 2022-08-22 17:16:06 +08:00
parent 52fa511d52
commit 9fdc1491b4
4 changed files with 12 additions and 6 deletions

View File

@ -29,14 +29,14 @@ class LoginController extends Controller
public function store(LoginRequest $request) public function store(LoginRequest $request)
{ {
if (!auth(Customer::AUTH_GUARD)->attempt($request->only('email', 'password'))) { if (!auth(Customer::AUTH_GUARD)->attempt($request->only('email', 'password'))) {
throw new \Exception("账号密码错误!"); throw new \Exception(trans('shop/login.email_or_password_error'));
} }
$customer = current_customer(); $customer = current_customer();
if ($customer && $customer->status != 1) { if ($customer && $customer->status != 1) {
Auth::guard(Customer::AUTH_GUARD)->logout(); Auth::guard(Customer::AUTH_GUARD)->logout();
throw new \Exception("用户已被禁用!"); throw new \Exception(trans('shop/login.customer_inactive'));
} }
return json_success("登录成功!"); return json_success(trans('shop/login.login_successfully'));
} }
} }

View File

@ -12,6 +12,7 @@
return [ return [
'index' => 'User login and registration', 'index' => 'User login and registration',
'login_and_sign' => 'Login/Sign In',
'home' => 'home', 'home' => 'home',
'library' => 'library', 'library' => 'library',
'login' => 'login', 'login' => 'login',
@ -21,7 +22,6 @@ return [
'email_address' => 'email address', 'email_address' => 'email address',
'password' => 'password', 'password' => 'password',
'forget_password' => 'forget password', 'forget_password' => 'forget password',
'login' => 'login',
'new' => 'new account', 'new' => 'new account',
'not_already' => 'Not yet our registered customer?', 'not_already' => 'Not yet our registered customer?',
'confirm_password' => 'confirm password', 'confirm_password' => 'confirm password',
@ -32,4 +32,7 @@ return [
'password_err' => 'The passwords entered twice do not match!', 'password_err' => 'The passwords entered twice do not match!',
'email_err' => 'Please enter a valid email address!', 'email_err' => 'Please enter a valid email address!',
'check_form' => 'Please check that the form is filled out correctly', 'check_form' => 'Please check that the form is filled out correctly',
'email_or_password_error' => 'Email or Password is incorrect!',
'customer_inactive' => 'The customer is inactive!',
'login_successfully' => 'Login successfully!',
]; ];

View File

@ -12,6 +12,7 @@
return [ return [
'index' => '用户登录与注册', 'index' => '用户登录与注册',
'login_and_sign' => '登录/注册',
'home' => '首页', 'home' => '首页',
'library' => '个人中心', 'library' => '个人中心',
'login' => '登录', 'login' => '登录',
@ -21,7 +22,6 @@ return [
'email_address' => '邮件地址', 'email_address' => '邮件地址',
'password' => '密码', 'password' => '密码',
'forget_password' => '忘记密码', 'forget_password' => '忘记密码',
'login' => '登录',
'new' => '新账号', 'new' => '新账号',
'not_already' => '还不是我们的注册客户?', 'not_already' => '还不是我们的注册客户?',
'confirm_password' => '确认密码', 'confirm_password' => '确认密码',
@ -32,4 +32,7 @@ return [
'password_err' => '两次输入密码不一致!', 'password_err' => '两次输入密码不一致!',
'email_err' => '请输入正确邮箱地址!', 'email_err' => '请输入正确邮箱地址!',
'check_form' => '请检查表单是否填写正确', 'check_form' => '请检查表单是否填写正确',
'email_or_password_error' => '邮件或密码错误!',
'customer_inactive' => '用户已被禁用',
'login_successfully' => '登录成功',
]; ];

View File

@ -127,7 +127,7 @@
退出登录</a></li> 退出登录</a></li>
@else @else
<li><a href="{{ shop_route('login.index') }}" class="dropdown-item"><i <li><a href="{{ shop_route('login.index') }}" class="dropdown-item"><i
class="bi bi-box-arrow-right me-1"></i> 登录/注册</a></li> class="bi bi-box-arrow-right me-1"></i>{{ __('shop/login.login_and_sign') }}</a></li>
@endauth @endauth
</ul> </ul>
</li> </li>