wip
This commit is contained in:
@@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Support\Facades\Date;
|
use Illuminate\Support\Facades\Date;
|
||||||
use Spatie\Permission\Traits\HasRoles;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
@@ -23,8 +22,6 @@ class User extends Authenticatable
|
|||||||
{
|
{
|
||||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
use HasRoles;
|
|
||||||
use Notifiable;
|
use Notifiable;
|
||||||
use UserAdjustments;
|
use UserAdjustments;
|
||||||
|
|
||||||
|
|||||||
@@ -170,4 +170,14 @@ class RegisterController extends Controller
|
|||||||
|
|
||||||
return redirect(config()->string('module.base-auth.redirect_path'));
|
return redirect(config()->string('module.base-auth.redirect_path'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resend verification
|
||||||
|
*/
|
||||||
|
public function resendVerification(): RedirectResponse
|
||||||
|
{
|
||||||
|
sendSMSVerification((string) user()->phone);
|
||||||
|
|
||||||
|
return to_route('sms-verification');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,4 +29,5 @@ return [
|
|||||||
'change_phone_label' => 'Telefon belgini üýtgetmek',
|
'change_phone_label' => 'Telefon belgini üýtgetmek',
|
||||||
'go_back' => 'Yza',
|
'go_back' => 'Yza',
|
||||||
'successfully_changed_phone' => 'Telefon belgiňiz üýtgedildi',
|
'successfully_changed_phone' => 'Telefon belgiňiz üýtgedildi',
|
||||||
|
'resend' => 'Täze tassyklaýyş belgi ugratmak'
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -61,11 +61,22 @@
|
|||||||
|
|
||||||
<span id="phone-error-box" class="text-red-500 text-italic error-box"></span>
|
<span id="phone-error-box" class="text-red-500 text-italic error-box"></span>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="w-full flex justify-center shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 w-full flex justify-center cursor-pointer rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 inline-flex items-center justify-center h-9 px-3 mb-3 w-full flex justify-center shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 w-full flex justify-center">
|
<button type="button" class="w-full flex justify-center shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 w-full flex justify-center cursor-pointer rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 inline-flex items-center justify-center h-9 px-3 mb-3 w-full flex justify-center shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 w-full flex justify-center">
|
||||||
<span class=""><span>{{ __('module.base-auth::base.change_number') }}</span></span>
|
<span class=""><span>{{ __('module.base-auth::base.change_number') }}</span></span>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="flex justify-center items-center mb-6">
|
||||||
|
<form id="resend-verification-form" action="{{ route('resend-verification') }}" method="POST">
|
||||||
|
@csrf
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<span id="resend-verification-trigger" class="text-center font-normal mr-4 underline cursor-pointer d-none" onclick="requestNewVerification()">
|
||||||
|
{{ __('module.base-auth::base.resend') }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{-- Verification form --}}
|
{{-- Verification form --}}
|
||||||
<form method="POST" action="{{ route('sms-verification') }}" id="verification-form">
|
<form method="POST" action="{{ route('sms-verification') }}" id="verification-form">
|
||||||
@csrf
|
@csrf
|
||||||
@@ -81,7 +92,8 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="w-full flex justify-center shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 w-full flex justify-center cursor-pointer rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 inline-flex items-center justify-center h-9 px-3 mb-3 w-full flex justify-center shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 w-full flex justify-center">
|
|
||||||
|
<button type="submit" class="w-full justify-center shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 cursor-pointer rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 inline-flex items-center h-9 px-3 mb-3 bg-primary-500 hover:bg-primary-400">
|
||||||
<span class=""><span>{{ __('module.base-auth::base.submit') }}</span></span>
|
<span class=""><span>{{ __('module.base-auth::base.submit') }}</span></span>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -98,9 +110,15 @@ let changePhoneform = $_ID('change-phone-form')
|
|||||||
let verificationForm = $_ID('verification-form')
|
let verificationForm = $_ID('verification-form')
|
||||||
let changePhoneButton = $_ID('change-phone-button')
|
let changePhoneButton = $_ID('change-phone-button')
|
||||||
let goBackButton = $_ID('go-back-button')
|
let goBackButton = $_ID('go-back-button')
|
||||||
|
let resendVerificationTrigger = $_ID('resend-verification-trigger')
|
||||||
|
let resendVerificationForm = $_ID('resend-verification-form')
|
||||||
|
|
||||||
ready(() => {
|
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() {
|
async function goBack() {
|
||||||
@@ -125,7 +143,7 @@ async function changePhone(event) {
|
|||||||
if (response.errors) {
|
if (response.errors) {
|
||||||
loopObject(response.errors, item => addValidationClasses(item))
|
loopObject(response.errors, item => addValidationClasses(item))
|
||||||
|
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
removeValidationClasess()
|
removeValidationClasess()
|
||||||
@@ -138,7 +156,11 @@ async function changePhone(event) {
|
|||||||
showCancelButton: false,
|
showCancelButton: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
window.location.href = response.url;
|
window.location.href = response.url
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestNewVerification() {
|
||||||
|
resendVerificationForm.submit()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -20,9 +20,10 @@ Route::middleware(['web', 'guest'])->group(function () {
|
|||||||
Route::middleware(['web', 'auth', RedirectIfUserPhoneIsVerfied::class])->group(function () {
|
Route::middleware(['web', 'auth', RedirectIfUserPhoneIsVerfied::class])->group(function () {
|
||||||
Route::post('change-phone', [RegisterController::class, 'changePhone'])->name('change-phone');
|
Route::post('change-phone', [RegisterController::class, 'changePhone'])->name('change-phone');
|
||||||
|
|
||||||
|
Route::post('resend-verification', [RegisterController::class, 'resendVerification'])->name('resend-verification');
|
||||||
|
|
||||||
Route::get('sms-verification', [RegisterController::class, 'smsVerification'])
|
Route::get('sms-verification', [RegisterController::class, 'smsVerification'])
|
||||||
->name('sms-verification');
|
->name('sms-verification');
|
||||||
|
|
||||||
Route::post('sms-verification', [RegisterController::class, 'verifySmsCode']);
|
Route::post('sms-verification', [RegisterController::class, 'verifySmsCode']);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Modules\UserAdjustments\Traits;
|
namespace App\Modules\UserAdjustments\Traits;
|
||||||
|
|
||||||
|
use Spatie\Permission\Traits\HasRoles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property string $username [unique]
|
* @property string $username [unique]
|
||||||
* @property string|null $first_name
|
* @property string|null $first_name
|
||||||
@@ -15,6 +17,8 @@ namespace App\Modules\UserAdjustments\Traits;
|
|||||||
*/
|
*/
|
||||||
trait UserAdjustments
|
trait UserAdjustments
|
||||||
{
|
{
|
||||||
|
use HasRoles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the attributes that should be cast.
|
* Get the attributes that should be cast.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user