This commit is contained in:
2023-12-03 15:04:10 +05:00
parent 21aab6ca7d
commit b4521e6f24
3 changed files with 13 additions and 3 deletions

View File

@@ -38,6 +38,9 @@ class ResetPasswordController extends Controller
$user = User::where('username', $request->username)->first(); $user = User::where('username', $request->username)->first();
// sendSMSVerification($user->phone); // sendSMSVerification($user->phone);
$phone_code = rand(10000, 99999);
$verification = Verification::where(['username' => $user->phone])->first();
$verification ? $verification->update(['code' => $phone_code]) : Verification::create(['username' => $user->phone, 'code' => $phone_code]);
return response()->json([ return response()->json([
'step' => 1, 'step' => 1,

View File

@@ -92,11 +92,11 @@ class User extends Resource
NovaInputmask::make(__('Phone'), 'phone') NovaInputmask::make(__('Phone'), 'phone')
->mask('+(\\9\\93)-99-99-99-99') ->mask('+(\\9\\93)-99-99-99-99')
->storeRawValue() ->storeRawValue()
->rules('required', 'integer', 'between:61000000, 71999999'), ->rules('nullable', 'integer', 'between:61000000, 71999999'),
Text::make(__('Email'), 'email') Text::make(__('Email'), 'email')
->sortable() ->sortable()
->rules('required', 'email', 'max:254') ->rules('nullable', 'email', 'max:254')
->creationRules('unique:users,email') ->creationRules('unique:users,email')
->updateRules('unique:users,email,{{resourceId}}'), ->updateRules('unique:users,email,{{resourceId}}'),

View File

@@ -49,7 +49,13 @@
{{ __('Verification code') }} {{ __('Verification code') }}
</label> </label>
<input class="form-control form-input form-input-bordered w-full" id="verification" type="text" name="verification"> <input
class="form-control form-input form-input-bordered w-full"
id="verification"
type="text"
name="verification"
value=""
>
<span id="verification-error-box" class="text-red-500 text-italic error-box"></span> <span id="verification-error-box" class="text-red-500 text-italic error-box"></span>
</div> </div>
@@ -87,6 +93,7 @@ async function resetPassword(event) {
const response = await postData(event.target.action, getFormData(event)) const response = await postData(event.target.action, getFormData(event))
if (response.errors) { if (response.errors) {
console.log(response.errors);
loopObject(response.errors, item => addValidationClasses(item)) loopObject(response.errors, item => addValidationClasses(item))
} else { } else {
removeValidationClasess() removeValidationClasess()