diff --git a/app/Models/User.php b/app/Models/User.php index 14c9879..5d058a0 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Illuminate\Support\Facades\Date; -use Spatie\Permission\Traits\HasRoles; /** * @property int $id @@ -23,8 +22,6 @@ class User extends Authenticatable { /** @use HasFactory<\Database\Factories\UserFactory> */ use HasFactory; - - use HasRoles; use Notifiable; use UserAdjustments; diff --git a/app/Modules/BaseAuth/Controllers/RegisterController.php b/app/Modules/BaseAuth/Controllers/RegisterController.php index 739ea14..0ab21fb 100644 --- a/app/Modules/BaseAuth/Controllers/RegisterController.php +++ b/app/Modules/BaseAuth/Controllers/RegisterController.php @@ -170,4 +170,14 @@ class RegisterController extends Controller return redirect(config()->string('module.base-auth.redirect_path')); } + + /** + * Resend verification + */ + public function resendVerification(): RedirectResponse + { + sendSMSVerification((string) user()->phone); + + return to_route('sms-verification'); + } } diff --git a/app/Modules/BaseAuth/Resources/Lang/tk/base.php b/app/Modules/BaseAuth/Resources/Lang/tk/base.php index 47b7def..6be8c5a 100644 --- a/app/Modules/BaseAuth/Resources/Lang/tk/base.php +++ b/app/Modules/BaseAuth/Resources/Lang/tk/base.php @@ -29,4 +29,5 @@ return [ 'change_phone_label' => 'Telefon belgini üýtgetmek', 'go_back' => 'Yza', 'successfully_changed_phone' => 'Telefon belgiňiz üýtgedildi', + 'resend' => 'Täze tassyklaýyş belgi ugratmak' ]; diff --git a/app/Modules/BaseAuth/Resources/Views/pages/sms-verification.blade.php b/app/Modules/BaseAuth/Resources/Views/pages/sms-verification.blade.php index 3241cad..7df88bb 100644 --- a/app/Modules/BaseAuth/Resources/Views/pages/sms-verification.blade.php +++ b/app/Modules/BaseAuth/Resources/Views/pages/sms-verification.blade.php @@ -61,11 +61,22 @@ - + {{ __('module.base-auth::base.change_number') }} + + + + @csrf + + + + {{ __('module.base-auth::base.resend') }} + + + {{-- Verification form --}} @csrf @@ -81,7 +92,8 @@ @endforeach @endif - + + {{ __('module.base-auth::base.submit') }} @@ -98,9 +110,15 @@ let changePhoneform = $_ID('change-phone-form') let verificationForm = $_ID('verification-form') let changePhoneButton = $_ID('change-phone-button') let goBackButton = $_ID('go-back-button') +let resendVerificationTrigger = $_ID('resend-verification-trigger') +let resendVerificationForm = $_ID('resend-verification-form') ready(() => { - new Inputmask("+(\\9\\93)-99-99-99-99").mask(phoneField); + new Inputmask("+(\\9\\93)-99-99-99-99").mask(phoneField) + + setTimeout(() => { + show(resendVerificationTrigger) + }, 5000) }) async function goBack() { @@ -125,7 +143,7 @@ async function changePhone(event) { if (response.errors) { loopObject(response.errors, item => addValidationClasses(item)) - return; + return } removeValidationClasess() @@ -138,7 +156,11 @@ async function changePhone(event) { showCancelButton: false, }) - window.location.href = response.url; + window.location.href = response.url +} + +function requestNewVerification() { + resendVerificationForm.submit() }