mirror of https://github.com/4xmen/xshop.git
parent
c6ade855d2
commit
1b2123daac
@ -0,0 +1,50 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
function isValidMobile(p) {
|
||||||
|
const regex = /^(\+|[0-9])([0-9]{9,14})$/gm;
|
||||||
|
return regex.test(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
document.querySelector('#send-auth-code')?.addEventListener('click', async function () {
|
||||||
|
let url = this.getAttribute('data-route');
|
||||||
|
let tel = document.querySelector('#tel').value;
|
||||||
|
if (tel.length < 11 || !isValidMobile(tel)){
|
||||||
|
window.$toast.error('Invalid mobile');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let resp = await axios.get(url+'?tel='+tel);
|
||||||
|
if (resp.data.OK){
|
||||||
|
window.$toast.success(resp.data.message);
|
||||||
|
document.querySelector('#tel').setAttribute('readonly','');
|
||||||
|
document.querySelector('.not-send').style.display = 'block';
|
||||||
|
document.querySelector('.sent').style.display = 'none';
|
||||||
|
}else{
|
||||||
|
window.$toast.error(resp.data.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.querySelector('#send-auth-check')?.addEventListener('click', async function () {
|
||||||
|
let url = this.getAttribute('data-route');
|
||||||
|
let tel = document.querySelector('#tel').value;
|
||||||
|
let code = document.querySelector('#auth').value;
|
||||||
|
if (tel.length < 11 || !isValidMobile(tel)){
|
||||||
|
window.$toast.error('Invalid mobile');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (code.length != 5 ){
|
||||||
|
window.$toast.error('Invalid code');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let resp = await axios.get(url+'?tel='+tel+'&code='+code);
|
||||||
|
if (resp.data.OK){
|
||||||
|
window.$toast.success(resp.data.message);
|
||||||
|
setTimeout( () => {
|
||||||
|
window.location.href = this.getAttribute('data-profile');
|
||||||
|
},5000);
|
||||||
|
}else{
|
||||||
|
window.$toast.error(resp.data.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,54 @@
|
|||||||
|
<section id='LoginBigBg'
|
||||||
|
style="background-image: url('{{asset('upload/images/'.$data->area->name.'.'.$data->part.'.jpg')}}')">
|
||||||
|
<form @if(!config('app.sign.sms')) action="{{route('client.sign-in-do')}}" @endif id="login-form" method="post">
|
||||||
|
@csrf
|
||||||
|
<h3>
|
||||||
|
{{$subtitle}}
|
||||||
|
</h3>
|
||||||
|
<div class="text-start">
|
||||||
|
@include('components.err')
|
||||||
|
</div>
|
||||||
|
<div id="login-content">
|
||||||
|
@if(!config('app.sign.sms'))
|
||||||
|
<label>
|
||||||
|
{{__("Email")}}
|
||||||
|
</label>
|
||||||
|
<input type="email" class="form-control" placeholder="{{__("Email")}}" name="email"
|
||||||
|
value="{{old('email')}}">
|
||||||
|
<label class="mt-2">
|
||||||
|
{{__("Password")}}
|
||||||
|
</label>
|
||||||
|
<input type="password" class="form-control" placeholder="{{__('Password')}}" name="password">
|
||||||
|
<button class="btn btn-outline-primary w-100 mt-3">
|
||||||
|
{{__("Sign-in")}}
|
||||||
|
</button>
|
||||||
|
@else
|
||||||
|
<label>
|
||||||
|
{{__("Mobile")}}
|
||||||
|
</label>
|
||||||
|
<input type="tel" maxlength="12" class="form-control text-center"
|
||||||
|
id="tel" placeholder="{{__("09xxxxxxxx")}}">
|
||||||
|
<div class="not-send">
|
||||||
|
<label>
|
||||||
|
{{__("Auth code")}}
|
||||||
|
</label>
|
||||||
|
<input type="tel" maxlength="5" minlength="5" id="auth" class="form-control text-center" placeholder="xxxxx">
|
||||||
|
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-outline-primary w-100 mt-3"
|
||||||
|
id="send-auth-check" data-route="{{route('client.check-auth')}}" data-profile="{{route('client.profile')}}">
|
||||||
|
{{__("Check authenticate code")}}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="sent">
|
||||||
|
<button type="button" class="btn btn-outline-primary w-100 mt-3"
|
||||||
|
id="send-auth-code" data-route="{{route('client.send-sms')}}">
|
||||||
|
{{__("Send authenticate code")}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "LoginBigBg",
|
||||||
|
"version": "1.0",
|
||||||
|
"author": "xStack",
|
||||||
|
"email": "xshop@xstack.ir",
|
||||||
|
"license": "GPL-3.0-or-later",
|
||||||
|
"url": "https:\/\/xstack.ir",
|
||||||
|
"author_url": "https:\/\/4xmen.ir",
|
||||||
|
"packages": []
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Resources\Views\Segments;
|
||||||
|
|
||||||
|
use App\Models\Part;
|
||||||
|
use App\Models\Setting;
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
|
|
||||||
|
class LoginBigBg
|
||||||
|
{
|
||||||
|
public static function onAdd(Part $part = null)
|
||||||
|
{
|
||||||
|
$setting = new Setting();
|
||||||
|
$setting->section = 'theme';
|
||||||
|
$setting->key = $part->area->name . '_' . $part->part.'_jpg';
|
||||||
|
$setting->value = null;
|
||||||
|
$setting->type = 'FILE';
|
||||||
|
$setting->size = 12;
|
||||||
|
$setting->title = $part->area->name . ' ' . $part->part.' background image';
|
||||||
|
$setting->save();
|
||||||
|
|
||||||
|
File::copy(__DIR__.'/../../default-assets/bg-girl.jpg',public_path('upload/images/').$part->area->name . '.' . $part->part.'.jpg');
|
||||||
|
}
|
||||||
|
public static function onRemove(Part $part = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public static function onMount(Part $part = null)
|
||||||
|
{
|
||||||
|
return $part;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
#LoginBigBg {
|
||||||
|
height: 90vh;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
|
||||||
|
#login-form{
|
||||||
|
max-width: 90%;
|
||||||
|
width: 450px;
|
||||||
|
}
|
||||||
|
#login-content{
|
||||||
|
|
||||||
|
text-align: start;
|
||||||
|
padding: 1rem;
|
||||||
|
background: #ffffff99;
|
||||||
|
backdrop-filter: blur(4px);
|
||||||
|
border-radius: var(--xshop-border-radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
.not-send{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 971 KiB |
Loading…
Reference in New Issue