fix: translate error and success msgs in email & phone verif
This commit is contained in:
parent
999f0d0e75
commit
f90891342f
|
|
@ -146,6 +146,16 @@ return [
|
|||
'online_payment_failed' => 'Online payment has been failed.',
|
||||
'bank_payment_saved' => 'The bank transfer payment saved. Admin will consider it and approve later.',
|
||||
'bank_payment_failed' => 'The bank transfer payment failed.',
|
||||
// 'contact_message_sent' => 'Contact message has been sent',
|
||||
'cannot_verify_invalid_email' => 'Cannot verify. Invalid email address.',
|
||||
'verification_link_sent' => 'Verification link has been sent to your email. Log in to tmex.gov.tm before checking your email.',
|
||||
'email_already_verified' => 'You have already verified your email address.',
|
||||
'sms_sent' => 'SMS has been sent.',
|
||||
'sms_not_sent_error' => 'SMS has not been sent. Error.',
|
||||
'user_not_tm_resident' => 'This user is not a resident.',
|
||||
'phone_already_verified' => 'You have already verified your phone number.',
|
||||
'phone_verified_message' => 'Your phone number has been succesfully verified',
|
||||
'phone_verification_code_invalid' => 'Invalid sms code',
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -146,6 +146,16 @@ return [
|
|||
'online_payment_failed' => 'Онлайн оплата не прошла.',
|
||||
'bank_payment_saved' => 'Оплата банковским переводом сохранена и позже будет проверена администратором.',
|
||||
'bank_payment_failed' => 'Оплата банковским переводом не прошла.',
|
||||
// 'contact_message_sent' => 'Письмо отправлено.',
|
||||
'cannot_verify_invalid_email' => 'Верификация Email невозможна. Неверный Email',
|
||||
'verification_link_sent' => 'Ссылка для подтверждения отправлена на ваш Email. Авторизуйтесь на tmex.gov.tm перед проверкой Email.',
|
||||
'email_already_verified' => 'Вы уже подтвердили свой Email.',
|
||||
'sms_sent' => 'СМС отправлен.',
|
||||
'sms_not_sent_error' => 'СМС не отправлен. Ошибка.',
|
||||
'user_not_tm_resident' => 'Пользователь не является резидентом.',
|
||||
'phone_already_verified' => 'Номер телефона уже подтвержден.',
|
||||
'phone_verified_message' => 'Ваш номер телефона подтвержден',
|
||||
'phone_verification_code_invalid' => 'Неверный СМС код',
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -148,6 +148,16 @@ return [
|
|||
'online_payment_failed' => 'Onlaýn töleg geçmedi.',
|
||||
'bank_payment_saved' => 'Bank üsti bilen töleg ýazyldy we soňra administrator tarapyndan gözden geçiriler.',
|
||||
'bank_payment_failed' => 'Bank üsti bilen töleg geçmedi.',
|
||||
// 'contact_message_sent' => 'Hat ugradyldy.',
|
||||
'cannot_verify_invalid_email' => 'Tassyklama grçmedi. El. bukjaňyz nädogry.',
|
||||
'verification_link_sent' => 'Tassyklama düwmesi El. bukjaňyza iberildi. El. bukjaňyzy barlamazdan öň tmex.gov.tm-da şahsy hasabyňyza giriň.',
|
||||
'email_already_verified' => 'Siziň el. bukjaňyz eýýäm tassyklanan.',
|
||||
'sms_sent' => 'SMS iberildi.',
|
||||
'sms_not_sent_error' => 'SMS iberilmedi. Ýalňyş.',
|
||||
'user_not_tm_resident' => 'Ulanyjy ýerli ýaşaýjy däl.',
|
||||
'phone_already_verified' => 'Siziň telefon belgiňiz eýýäm tassyklanan.',
|
||||
'phone_verified_message' => 'Siziň telefon belgiňiz tassyklandy',
|
||||
'phone_verification_code_invalid' => 'Nädogry SMS kody',
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -34,16 +34,16 @@ class EmailVerificationController extends KabinetAPIController
|
|||
} catch(Throwable $th) {
|
||||
\Log::info($th);
|
||||
|
||||
return response()->json('Cannot verify. Invalid email address.', 400);
|
||||
return response()->json(trans('validation.api.cannot_verify_invalid_email', [], $inputData['locale']), 400);
|
||||
}
|
||||
|
||||
$this->user->email_activation_code = $code;
|
||||
$this->user->save();
|
||||
|
||||
return response()->json('Verification link has been sent. Log in to tmex.gov.tm before checking your email.', 201);
|
||||
return response()->json(trans('validation.api.verification_link_sent', [], $inputData['locale']), 201);
|
||||
|
||||
} else {
|
||||
return response()->json('You have already verified your email address.', 200);
|
||||
return response()->json(trans('validation.api.email_already_verified', [], $inputData['locale']), 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,12 +30,24 @@ class SmsController extends KabinetAPIController
|
|||
if($this->user->dial_code != '+993') {
|
||||
return response()->json([
|
||||
'dial_code' => $this->user->dial_code,
|
||||
'message' => 'This user is not a resident of Turkmenistan.'
|
||||
'result' => 1,
|
||||
'message' => [
|
||||
'ru' => trans('validation.api.user_not_tm_resident', [], 'ru'),
|
||||
'en' => trans('validation.api.user_not_tm_resident', [], 'en'),
|
||||
'tm' => trans('validation.api.user_not_tm_resident', [], 'tm'),
|
||||
]
|
||||
], 400);
|
||||
}
|
||||
|
||||
if($this->user->phone_verified && $this->user->dial_code == '+993') {
|
||||
return response()->json('User phone already verified', 200);
|
||||
return response()->json([
|
||||
'result' => 1,
|
||||
'message' => [
|
||||
'ru' => trans('validation.api.phone_already_verified', [], 'ru'),
|
||||
'en' => trans('validation.api.phone_already_verified', [], 'en'),
|
||||
'tm' => trans('validation.api.phone_already_verified', [], 'tm'),
|
||||
]
|
||||
], 200);
|
||||
}
|
||||
|
||||
$code = random_int(1000, 9999);
|
||||
|
|
@ -49,21 +61,33 @@ class SmsController extends KabinetAPIController
|
|||
$this->user->save();
|
||||
return response()->json([
|
||||
'result' => $result,
|
||||
'message' => 'Message has been succesfully sent'
|
||||
'message' => [
|
||||
'ru' => trans('validation.api.sms_sent', [], 'ru'),
|
||||
'en' => trans('validation.api.sms_sent', [], 'en'),
|
||||
'tm' => trans('validation.api.sms_sent', [], 'tm'),
|
||||
]
|
||||
], 201);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
return response()->json([
|
||||
'result' => $result,
|
||||
'message' => 'Error'
|
||||
'message' => [
|
||||
'ru' => trans('validation.api.sms_not_sent_error', [], 'ru'),
|
||||
'en' => trans('validation.api.sms_not_sent_error', [], 'en'),
|
||||
'tm' => trans('validation.api.sms_not_sent_error', [], 'tm'),
|
||||
]
|
||||
], 500);
|
||||
break;
|
||||
|
||||
default:
|
||||
return response()->json([
|
||||
'result' => $result,
|
||||
'message' => 'Error'
|
||||
'message' => [
|
||||
'ru' => trans('validation.api.sms_not_sent_error', [], 'ru'),
|
||||
'en' => trans('validation.api.sms_not_sent_error', [], 'en'),
|
||||
'tm' => trans('validation.api.sms_not_sent_error', [], 'tm'),
|
||||
]
|
||||
], 500);
|
||||
break;
|
||||
}
|
||||
|
|
@ -74,12 +98,24 @@ class SmsController extends KabinetAPIController
|
|||
if($this->user->dial_code != '+993') {
|
||||
return response()->json([
|
||||
'dial_code' => $this->user->dial_code,
|
||||
'message' => 'This user is not a resident of Turkmenistan.'
|
||||
'status' => false,
|
||||
'message' => [
|
||||
'ru' => trans('validation.api.user_not_tm_resident', [], 'ru'),
|
||||
'en' => trans('validation.api.user_not_tm_resident', [], 'en'),
|
||||
'tm' => trans('validation.api.user_not_tm_resident', [], 'tm'),
|
||||
]
|
||||
], 400);
|
||||
}
|
||||
|
||||
if($this->user->phone_verified && $this->user->dial_code == '+993') {
|
||||
return response()->json('User phone already verified', 200);
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => [
|
||||
'ru' => trans('validation.api.phone_already_verified', [], 'ru'),
|
||||
'en' => trans('validation.api.phone_already_verified', [], 'en'),
|
||||
'tm' => trans('validation.api.phone_already_verified', [], 'tm'),
|
||||
]
|
||||
], 200);
|
||||
}
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
|
|
@ -93,9 +129,23 @@ class SmsController extends KabinetAPIController
|
|||
$this->user->phone_verified = true;
|
||||
$this->user->phone_activation_code = null;
|
||||
$this->user->save();
|
||||
return response()->json('User phone has been succesfully verified', 201);
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'message' => [
|
||||
'ru' => trans('validation.api.phone_verified_message', [], 'ru'),
|
||||
'en' => trans('validation.api.phone_verified_message', [], 'en'),
|
||||
'tm' => trans('validation.api.phone_verified_message', [], 'tm'),
|
||||
]
|
||||
], 201);
|
||||
} else {
|
||||
return response()->json('Wrong sms code', 400);
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => [
|
||||
'ru' => trans('validation.api.phone_verification_code_invalid', [], 'ru'),
|
||||
'en' => trans('validation.api.phone_verification_code_invalid', [], 'en'),
|
||||
'tm' => trans('validation.api.phone_verification_code_invalid', [], 'tm'),
|
||||
]
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ return [
|
|||
'email_verification_check_message' => 'El. bukjaňyzy barlamygyňyzy haýyş edýäris',
|
||||
'email_verified_message' => 'Siziň el. bukjaňyz tassyklandy',
|
||||
'email_verification_link_invalid' => 'Tassyklama kody nädogry',
|
||||
'email_already_verified' => 'Siz el. bukjaňyz eýýäm tassyklanan',
|
||||
'email_already_verified' => 'Siziň el. bukjaňyz eýýäm tassyklanan',
|
||||
'phone_verified_message' => 'Siziň el telefonyňyz tassyklandy',
|
||||
'phone_verification_code_invalid' => 'Nädogry SMS kody',
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue