feat. 會員端google auth 加入,加入一些valid
This commit is contained in:
parent
87a0ddf7bd
commit
d022b0635a
@ -48,9 +48,9 @@ public function handleProviderCallback(Request $request)
|
||||
$user = Socialite::driver('line')->user();
|
||||
Log::info('line', ['user' => $user]);
|
||||
$lineId = $user->getId();
|
||||
$name = $user->getName();
|
||||
$name = $user->getName();
|
||||
$avatar = $user->getAvatar() ?? '';
|
||||
$email = $user->getEmail() ?? '';
|
||||
$email = $user->getEmail() ?? '';
|
||||
|
||||
Log::info('email', [$email]);
|
||||
|
||||
@ -64,12 +64,12 @@ public function handleProviderCallback(Request $request)
|
||||
Auth::guard('web')->login($existingUser);
|
||||
} else {
|
||||
$newUser = User::create([
|
||||
'name' => $name,
|
||||
'line_id' => $lineId,
|
||||
'name' => $name,
|
||||
'line_id' => $lineId,
|
||||
'password' => bcrypt(env('DEFAULT_PASSWORD')),
|
||||
'avatar' => $avatar,
|
||||
'source' => 'cafeg',
|
||||
'email' => $email,
|
||||
'avatar' => $avatar,
|
||||
'source' => 'cafeg',
|
||||
'email' => $email,
|
||||
]);
|
||||
Auth::guard('web')->login($newUser);
|
||||
}
|
||||
@ -87,12 +87,13 @@ public function handleProviderCallback(Request $request)
|
||||
Auth::guard('member')->login($existingUser);
|
||||
} else {
|
||||
$newUser = Member::create([
|
||||
'name' => $name,
|
||||
'line_id' => $lineId,
|
||||
'name' => $name,
|
||||
'line_id' => $lineId,
|
||||
'password' => bcrypt(env('DEFAULT_PASSWORD')),
|
||||
'avatar' => $avatar,
|
||||
'source' => 'cafeg',
|
||||
'email' => $email,
|
||||
'source' => 'cafeg',
|
||||
'avatar' => $avatar,
|
||||
|
||||
'email' => $email,
|
||||
]);
|
||||
Auth::guard('member')->login($newUser);
|
||||
}
|
||||
@ -138,4 +139,39 @@ public function memberNormalLogin(Request $request)
|
||||
return redirect()->route('front.login.view')->with('error', '帳號密碼錯誤');
|
||||
}
|
||||
}
|
||||
|
||||
// 重定向到 Google
|
||||
public function redirectToGoogle()
|
||||
{
|
||||
return Socialite::driver('google')->redirect();
|
||||
}
|
||||
|
||||
// 處理 Google 回調
|
||||
public function handleGoogleCallback()
|
||||
{
|
||||
try {
|
||||
$googleUser = Socialite::driver('google')->stateless()->user();
|
||||
|
||||
// 查找或創建用戶
|
||||
$user = Member::firstOrCreate(
|
||||
['email' => $googleUser->getEmail()],
|
||||
[
|
||||
'name' => $googleUser->getName(),
|
||||
'google_id' => $googleUser->getId(),
|
||||
'avatar' => $googleUser->getAvatar(),
|
||||
'password' => bcrypt(env('DEFAULT_PASSWORD')),
|
||||
'source' => 'cafeg',
|
||||
]
|
||||
);
|
||||
\Log::info('google Oauth :', [$user]);
|
||||
|
||||
|
||||
// 登入用戶
|
||||
Auth::guard('member')->login($user, true);
|
||||
|
||||
return redirect()->route('member.index'); // 登入後跳轉的路徑
|
||||
} catch (\Exception $e) {
|
||||
return redirect('/')->with('error', '無法進行 Google 登入');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,4 +91,15 @@ public function checkPhone(Request $request)
|
||||
return response()->json(['status' => 'success', 'msg' => '該電話號碼可用']);
|
||||
}
|
||||
|
||||
public function checkEmail(Request $request)
|
||||
{
|
||||
|
||||
$user = Member::where('email', $request->email)->first();
|
||||
|
||||
if ($user) {
|
||||
return response()->json(['status' => 'error', 'msg' => '該email已被其他帳戶使用']);
|
||||
}
|
||||
|
||||
return response()->json(['status' => 'success', 'msg' => '該email號碼可用']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,8 @@
|
||||
use Exception;
|
||||
use App\Models\EmailVerifications;
|
||||
use Mail;
|
||||
|
||||
use Log;
|
||||
use Auth;
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/**
|
||||
@ -45,7 +46,13 @@ public function create(Request $request)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Summary of forgotPassword 設定密碼頁面
|
||||
* @param mixed $id
|
||||
* @param mixed $token
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function forgotPassword(Request $request)
|
||||
{
|
||||
|
||||
@ -57,13 +64,13 @@ public function sendForgotPassword(Request $request)
|
||||
\Log::info('sendForgotPassword', []);
|
||||
$subject = "卡菲姬系統-密碼重新設定";
|
||||
$token = \Str::random(32);
|
||||
$result = Member::where('email', $request->email)->first();
|
||||
$result = Member::where('email', $request->email)->firstOrFail();
|
||||
|
||||
try {
|
||||
if (!isset($result)) {
|
||||
throw new Exception("找不到帳號", 404);
|
||||
} else {
|
||||
$verificationLink = route('reset.password.token', ['token' => $token, 'id' => $result->id]);
|
||||
$verificationLink = route('change.password', ['token' => $token, 'id' => $result->id]);
|
||||
|
||||
\Log::info('sendForgotPassword go EmailVerifications', []);
|
||||
$res = EmailVerifications::where('email', $request->email)->first();
|
||||
@ -128,24 +135,44 @@ public function resetPassword(Request $request)
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary of changePassword view
|
||||
* @param $id
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function changePassword(Request $request)
|
||||
{
|
||||
|
||||
return view('front.auth.confirmpassword');
|
||||
Log::info('request on changePassword : ', $request->all());
|
||||
|
||||
return view('front.auth.confirmpassword', ['id' => $request->id]);
|
||||
}
|
||||
|
||||
public function confrimPassword(Request $request)
|
||||
|
||||
/**
|
||||
* Summary of resetPasswordProcess
|
||||
* @param mixed $id
|
||||
* @method put
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function resetPasswordProcess(Request $request)
|
||||
{
|
||||
|
||||
if ($request->has('id')) {
|
||||
$member = Member::where('id', $request->id)->first();
|
||||
$member->password = bcrypt($request->password);
|
||||
$member->save();
|
||||
if ($member) {
|
||||
EmailVerifications::where('email', $member->email)->delete();
|
||||
}
|
||||
|
||||
return view('front.auth.confirmpassword');
|
||||
Auth::guard('member')->login($member);
|
||||
|
||||
}
|
||||
|
||||
public function resetPasswordProcess($id, Request $request)
|
||||
{
|
||||
}
|
||||
|
||||
return redirect()->route('member.index');
|
||||
|
||||
}
|
||||
|
||||
@ -154,7 +181,7 @@ public function resetPasswordProcess($id, Request $request)
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -34,10 +34,18 @@
|
||||
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
|
||||
],
|
||||
],
|
||||
|
||||
'line' => [
|
||||
'client_id' => env('LINE_CLIENT_ID'),
|
||||
'client_secret' => env('LINE_CLIENT_SECRET'),
|
||||
'redirect' => env('LINE_REDIRECT_URI'),
|
||||
],
|
||||
|
||||
'google' => [
|
||||
'client_id' => env('GOOGLE_CLIENT_ID'),
|
||||
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
|
||||
'redirect' => env('GOOGLE_REDIRECT_URI'),
|
||||
],
|
||||
|
||||
|
||||
];
|
||||
|
||||
@ -115,7 +115,7 @@ class="input-group-text cursor-pointer"
|
||||
class="form-control"
|
||||
placeholder="確認密碼"
|
||||
aria-label="確認密碼"
|
||||
value="{{$data->password ?? ''}}"
|
||||
value=" "
|
||||
|
||||
/>
|
||||
<label for="formValidationConfirmPass">確認密碼</label>
|
||||
@ -218,7 +218,7 @@ class="btn btn-outline-secondary"
|
||||
<!-- Include Scripts -->
|
||||
<!-- $isFront is used to append the front layout scripts only on the front layout otherwise the variable will be blank -->
|
||||
<!-- BEGIN: Vendor JS-->
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/libs/jquery/jquery.js" />
|
||||
{{-- <link rel="modulepreload" href="{{asset('assets')}}/vendor/libs/jquery/jquery.js" /> --}}
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/js/helpers.js" />
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/libs/popper/popper.js" />
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/js/bootstrap.js" />
|
||||
|
||||
@ -105,6 +105,7 @@
|
||||
</div>
|
||||
<span class="input-group-text cursor-pointer"><i class="ri-eye-off-line"></i></span>
|
||||
</div>
|
||||
<input type="hidden" name="id" value="{{ $id }}">
|
||||
</div>
|
||||
<div class="mb-5 form-password-toggle">
|
||||
<div class="input-group input-group-merge">
|
||||
|
||||
@ -184,7 +184,18 @@
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('email confirm');
|
||||
// 顯示 Loading 畫面
|
||||
Swal.fire({
|
||||
title: '請稍候',
|
||||
text: '正在處理中...',
|
||||
icon: 'info',
|
||||
allowOutsideClick: false, // 防止用戶關閉
|
||||
showConfirmButton: false, // 隱藏按鈕
|
||||
didOpen: () => {
|
||||
Swal.showLoading(); // 顯示 loading 動畫
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "{{ route('email.password.post') }}",
|
||||
@ -196,7 +207,8 @@
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
console.log('Server response:', response);
|
||||
Swal.close(); // 隱藏 Loading 畫面
|
||||
|
||||
if (response.status == 'success') {
|
||||
Swal.fire({
|
||||
title: '成功',
|
||||
@ -214,14 +226,25 @@
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('Error:', error);
|
||||
Swal.fire({
|
||||
title: '錯誤',
|
||||
text: "系統錯誤,請稍後再試",
|
||||
icon: 'error',
|
||||
confirmButtonText: '确定'
|
||||
});
|
||||
Swal.close(); // 隱藏 Loading 畫面
|
||||
|
||||
if (xhr.status == 404) {
|
||||
Swal.fire({
|
||||
title: '錯誤',
|
||||
text: "未找到有效帳號",
|
||||
icon: 'error',
|
||||
confirmButtonText: '确定'
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: '錯誤',
|
||||
text: "伺服器發生錯誤,請稍後再試",
|
||||
icon: 'error',
|
||||
confirmButtonText: '确定'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -172,11 +172,9 @@
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
|
||||
{{-- <a href="javascript:;" class="btn btn-icon rounded-circle btn-text-google-plus">
|
||||
<a href="{{route('google.auth')}}" class="btn btn-icon rounded-circle btn-text-google-plus">
|
||||
<i class="tf-icons ri-google-fill"></i>
|
||||
</a> --}}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -123,7 +123,7 @@
|
||||
<div class="form-floating form-floating-outline mb-5">
|
||||
<input type="email" class="form-control" id="email" name="email" placeholder="輸入你的帳號" required>
|
||||
<label for="email">Email(帳號)</label>
|
||||
<div class="invalid-feedback">請輸入有效的 Email 地址。</div>
|
||||
<div class="invalid-feedback" id = "checkemail">請輸入有效的 Email 地址。</div>
|
||||
</div>
|
||||
<div class="mb-5 form-password-toggle">
|
||||
<div class="input-group input-group-merge">
|
||||
@ -317,6 +317,44 @@ function validatePhoneField(field) {
|
||||
});
|
||||
});
|
||||
}
|
||||
function validateEmailField(field) {
|
||||
const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
const value = field.val().trim();
|
||||
|
||||
// 驗證格式
|
||||
if (!emailPattern.test(value)) {
|
||||
field.addClass('is-invalid');
|
||||
$("#checkphone").text('請輸入有效的 10 位手機號碼。').show();
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
// 檢查手機號是否已被註冊
|
||||
return new Promise((resolve) => {
|
||||
$.ajax({
|
||||
url: "{{ route('member.checkemail') }}",
|
||||
method: 'GET',
|
||||
data: {
|
||||
email: value
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.status === 'error') {
|
||||
field.addClass('is-invalid');
|
||||
$("#checkemail").text(response.msg).show(); // 顯示伺服器返回的錯誤訊息
|
||||
resolve(false);
|
||||
} else {
|
||||
field.removeClass('is-invalid');
|
||||
$("#checkemail").hide(); // 隱藏錯誤訊息
|
||||
resolve(true);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
field.addClass('is-invalid');
|
||||
$("#checkphone").text('檢查手機號時發生錯誤,請稍後再試。').show();
|
||||
resolve(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 綁定每個欄位的失焦事件
|
||||
$('#formAuthentication input').on('blur', function() {
|
||||
@ -325,6 +363,11 @@ function validatePhoneField(field) {
|
||||
} else {
|
||||
validateField($(this));
|
||||
}
|
||||
if ($(this).attr('id') === 'email') {
|
||||
validateEmailField($(this));
|
||||
} else {
|
||||
validateField($(this));
|
||||
}
|
||||
});
|
||||
|
||||
// 表單提交事件
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
<h5 class="card-header">兌換編碼</h5>
|
||||
<div class="card-body">
|
||||
<div class="form-floating form-floating-outline">
|
||||
<input type="text" class="form-control" id="floatingInput" aria-describedby="floatingInputHelp">
|
||||
<input type="text" class="form-control text-danger" style="font-size:24px; font-weight: bold;" id="floatingInput" aria-describedby="floatingInputHelp">
|
||||
<label for="floatingInput">兌換碼</label>
|
||||
{{-- <div id="floatingInputHelp" class="form-text">We'll never share your details with anyone else.</div> --}}
|
||||
</div>
|
||||
|
||||
@ -2,287 +2,393 @@
|
||||
|
||||
@section('content')
|
||||
|
||||
<!-- Content -->
|
||||
<div class="position-relative">
|
||||
<div class="authentication-wrapper authentication-basic container-p-y p-4 p-sm-0">
|
||||
<div class="authentication-inner py-6">
|
||||
<!-- Content -->
|
||||
<div class="position-relative">
|
||||
<div class="authentication-wrapper authentication-basic container-p-y p-4 p-sm-0">
|
||||
<div class="authentication-inner py-6">
|
||||
|
||||
<!-- Login -->
|
||||
<div class="card p-md-7 p-1">
|
||||
<!-- Logo -->
|
||||
<div class="app-brand justify-content-center mt-5">
|
||||
<a href="#" class="app-brand-link gap-2">
|
||||
<span class="app-brand-logo demo"><span>
|
||||
<img src="{{asset('assets/img/logo/cafeg-logo.png')}}" width="50px" height="50px" alt="{{asset('img/logo/cafeg-logo.png')}}"> </img>
|
||||
<!-- Login -->
|
||||
<div class="card p-md-7 p-1">
|
||||
<!-- Logo -->
|
||||
<div class="app-brand justify-content-center mt-5">
|
||||
<a href="#" class="app-brand-link gap-2">
|
||||
<span class="app-brand-logo demo"><span>
|
||||
<img src="{{ asset('assets/img/logo/cafeg-logo.png') }}" width="50px" height="50px"
|
||||
alt="{{ asset('img/logo/cafeg-logo.png') }}"> </img>
|
||||
|
||||
</span>
|
||||
</span>
|
||||
<span class="app-brand-text demo text-heading fw-semibold">
|
||||
<img src="{{ asset('assets/img/logo/cafeg-logo-h.png') }}" width="120px"
|
||||
height="50px" alt="{{ asset('img/logo/cafeg-logo.png') }}"> </img>
|
||||
|
||||
</span>
|
||||
</span>
|
||||
<span class="app-brand-text demo text-heading fw-semibold">
|
||||
<img src="{{asset('assets/img/logo/cafeg-logo-h.png')}}" width="120px" height="50px" alt="{{asset('img/logo/cafeg-logo.png')}}"> </img>
|
||||
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<!-- /Logo -->
|
||||
@php
|
||||
if(empty($data)){
|
||||
$data = Auth::guard('member')->user();
|
||||
unset($data['password']);
|
||||
}
|
||||
@endphp
|
||||
<div class="card-body mt-1">
|
||||
<h4 class="mb-1">卡菲姬個人資料</h4>
|
||||
<p class="mb-5">Hi, <span class="text-ifno"> {{$data->name }} 用戶 </span> 歡迎你 ! ,請花幾分鐘完善資料</p>
|
||||
|
||||
<div class="card" id="editUser">
|
||||
<div class="content">
|
||||
<div class="body p-0">
|
||||
<div class="text-center mb-6">
|
||||
<h4 class="mb-2">編輯您的資訊</h4>
|
||||
<p class="mb-6">更新用戶詳細資訊</p>
|
||||
</div>
|
||||
<form id="editUserForm" class="row g-5">
|
||||
<!-- 暱稱 -->
|
||||
<div class="col-12">
|
||||
<div class="form-floating form-floating-outline">
|
||||
<input readonly type="text" id="modalEditUserFirstName" name="modalEditUserFirstName" class="form-control" value="{{$data->name}}" placeholder="暱稱" aria-label="暱稱" />
|
||||
<label for="modalEditUserFirstName">暱稱</label>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<!-- /Logo -->
|
||||
@php
|
||||
if (empty($data)) {
|
||||
$data = Auth::guard('member')->user();
|
||||
unset($data['password']);
|
||||
}
|
||||
@endphp
|
||||
<div class="card-body mt-1">
|
||||
<h4 class="mb-1">卡菲姬個人資料</h4>
|
||||
<p class="mb-5">Hi, <span class="text-ifno"> {{ $data->name }} 用戶 </span> 歡迎你 ! ,請花幾分鐘完善資料</p>
|
||||
<div class="card" id="editUser">
|
||||
<div class="content">
|
||||
<div class="body p-0">
|
||||
<div class="text-center mb-6">
|
||||
<h4 class="mb-2">編輯您的資訊</h4>
|
||||
<p class="mb-6">更新用戶詳細資訊</p>
|
||||
</div>
|
||||
|
||||
<!-- Email -->
|
||||
<div class="col-12">
|
||||
<div class="form-floating form-floating-outline">
|
||||
<input type="email" id="formValidationEmail" class="form-control" placeholder="john.doe@example.com" aria-label="Email" required value="{{$data->email ?? ''}}" />
|
||||
<label for="formValidationEmail">Email</label>
|
||||
<div class="invalid-feedback">請輸入有效的 Email</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 密碼 -->
|
||||
<div class="col-12">
|
||||
<div class="form-password-toggle">
|
||||
<div class="input-group input-group-merge">
|
||||
<div class="form-floating form-floating-outline">
|
||||
<input type="password" id="basic-default-password" class="form-control" placeholder="密碼" aria-label="密碼" value="{{$data->password ?? ''}}" />
|
||||
<label for="basic-default-password">密碼</label>
|
||||
<div class="invalid-feedback">請輸入有效密碼</div>
|
||||
|
||||
</div>
|
||||
<span class="input-group-text cursor-pointer" id="basic-default-password3">
|
||||
<i class="ri-eye-off-line"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 確認密碼 -->
|
||||
<div class="col-12">
|
||||
<div class="form-password-toggle">
|
||||
<div class="input-group input-group-merge">
|
||||
<div class="form-floating form-floating-outline">
|
||||
<input type="password" id="formValidationConfirmPass" name="formValidationConfirmPass" class="form-control" placeholder="確認密碼" aria-label="確認密碼" value="{{$data->password ?? ''}}" />
|
||||
<label for="formValidationConfirmPass">確認密碼</label>
|
||||
<div class="invalid-feedback">密碼與確認密碼不相符</div>
|
||||
|
||||
</div>
|
||||
<span class="input-group-text cursor-pointer" id="multicol-confirm-password2">
|
||||
<i class="ri-eye-off-line"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 電話 -->
|
||||
<div class="col-12">
|
||||
<div class="input-group input-group-merge">
|
||||
|
||||
<form id="editUserForm" class="row g-5">
|
||||
<!-- 暱稱 -->
|
||||
<div class="col-12">
|
||||
<div class="form-floating form-floating-outline">
|
||||
<input type="text" id="modalEditUserPhone" name="modalEditUserPhone" class="form-control phone-number-mask" value="{{$data->phone ?? ''}}" placeholder="0920111222" aria-label="電話" />
|
||||
<label for="modalEditUserPhone">電話</label>
|
||||
<div class="invalid-feedback">請輸入有效電話</div>
|
||||
|
||||
<input readonly type="text" id="modalEditUserFirstName"
|
||||
name="modalEditUserFirstName" class="form-control"
|
||||
value="{{ $data->name }}" placeholder="暱稱" aria-label="暱稱" />
|
||||
<label for="modalEditUserFirstName">暱稱 </label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Email -->
|
||||
<div class="col-12">
|
||||
<div class="form-floating form-floating-outline">
|
||||
<input type="email" id="formValidationEmail" class="form-control"
|
||||
placeholder="john.doe@example.com" aria-label="Email" required
|
||||
value="{{ $data->email ?? '' }}" @if(isset($data->email)) readonly @endif />
|
||||
<label for="formValidationEmail">Email</label>
|
||||
<div class="invalid-feedback">請輸入有效的 Email</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 按鈕 -->
|
||||
<div class="col-12 text-center d-flex flex-wrap justify-content-center gap-4 row-gap-4">
|
||||
<button type="submit" class="btn btn-primary">送出</button>
|
||||
<button id='cancel' type="reset" class="btn btn-outline-secondary" data-bs-dismiss="modal" aria-label="Close">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<!-- 密碼 -->
|
||||
<div class="col-12">
|
||||
<div class="form-password-toggle">
|
||||
<div class="input-group input-group-merge">
|
||||
<div class="form-floating form-floating-outline">
|
||||
<input type="password" id="basic-default-password"
|
||||
class="form-control" placeholder="密碼" aria-label="密碼"
|
||||
value="" />
|
||||
<label for="basic-default-password">密碼</label>
|
||||
<div class="invalid-feedback">請輸入有效密碼</div>
|
||||
|
||||
</div>
|
||||
<span class="input-group-text cursor-pointer"
|
||||
id="basic-default-password3">
|
||||
<i class="ri-eye-off-line"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 確認密碼 -->
|
||||
<div class="col-12">
|
||||
<div class="form-password-toggle">
|
||||
<div class="input-group input-group-merge">
|
||||
<div class="form-floating form-floating-outline">
|
||||
<input type="password" id="formValidationConfirmPass"
|
||||
name="formValidationConfirmPass" class="form-control"
|
||||
placeholder="確認密碼" aria-label="確認密碼" value="" />
|
||||
<label for="formValidationConfirmPass">確認密碼</label>
|
||||
<div class="invalid-feedback">密碼與確認密碼不相符</div>
|
||||
|
||||
</div>
|
||||
<span class="input-group-text cursor-pointer"
|
||||
id="multicol-confirm-password2">
|
||||
<i class="ri-eye-off-line"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 電話 -->
|
||||
<div class="col-12">
|
||||
<div class="input-group input-group-merge">
|
||||
|
||||
<div class="form-floating form-floating-outline">
|
||||
<input type="text" id="modalEditUserPhone" name="modalEditUserPhone"
|
||||
class="form-control phone-number-mask" value="{{ $data->phone }}"
|
||||
placeholder="0920111222" aria-label="電話" />
|
||||
<label for="modalEditUserPhone">電話</label>
|
||||
<div class="invalid-feedback">請輸入有效電話</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 按鈕 -->
|
||||
<div
|
||||
class="col-12 text-center d-flex flex-wrap justify-content-center gap-4 row-gap-4">
|
||||
<button type="submit" class="btn btn-primary">送出</button>
|
||||
<button id='cancel' type="button" class="btn btn-outline-secondary"
|
||||
data-bs-dismiss="modal" aria-label="Close">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/ Content -->
|
||||
</div>
|
||||
<!--/ Content -->
|
||||
|
||||
<!--/ Layout Content -->
|
||||
<!--/ Layout Content -->
|
||||
|
||||
|
||||
{{-- <div class="buy-now">
|
||||
{{-- <div class="buy-now">
|
||||
<a href="#" target="" class="btn btn-danger btn-buy-now">Buy Now</a>
|
||||
</div> --}}
|
||||
|
||||
|
||||
<!-- Include Scripts -->
|
||||
<!-- $isFront is used to append the front layout scripts only on the front layout otherwise the variable will be blank -->
|
||||
<!-- BEGIN: Vendor JS-->
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/libs/jquery/jquery.js" />
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/js/helpers.js" />
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/libs/popper/popper.js" />
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/js/bootstrap.js" />
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/libs/node-waves/node-waves.js" />
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/libs/perfect-scrollbar/perfect-scrollbar.js" />
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/libs/hammer/hammer.js" />
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/libs/typeahead-js/typeahead.js" />
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/js/menu.js" />
|
||||
<script type="module" src="{{asset('assets')}}/vendor/libs/jquery/jquery.js"></script>
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/libs/@form-validation/popular.js" />
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/js/helpers.js" />
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/vendor/libs/@form-validation/bootstrap5.js" />
|
||||
{{-- <link rel="modulepreload" href="{{asset('assets')}}/index.js" /> --}}
|
||||
{{-- <link rel="modulepreload" href="{{asset('assets')}}/auto.js" /> --}}
|
||||
<script type="module" src="{{asset('assets')}}/vendor/libs/@form-validation/popular.js">
|
||||
</script>
|
||||
<script type="module" src="{{asset('assets')}}/vendor/libs/@form-validation/bootstrap5.js"></script>
|
||||
<script type="module" src="{{asset('assets')}}/vendor/libs/@form-validation/auto-focus.js"></script>
|
||||
<!-- END: Page Vendor JS-->
|
||||
<!-- BEGIN: Theme JS-->
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/js/main.js" />
|
||||
<script type="module" src="{{asset('assets')}}/js/main.js"></script>
|
||||
<!-- END: Theme JS-->
|
||||
<!-- Pricing Modal JS-->
|
||||
<!-- END: Pricing Modal JS-->
|
||||
<!-- BEGIN: Page JS-->
|
||||
<link rel="modulepreload" href="{{asset('assets')}}/js/pages-auth.js" />
|
||||
<script type="module" src="{{asset('assets')}}/js/pages-auth.js"></script>
|
||||
<!-- END: Page JS-->
|
||||
<script src="{{asset('assets')}}/js/form-validation.js"></script>
|
||||
<!-- Include Scripts -->
|
||||
<!-- $isFront is used to append the front layout scripts only on the front layout otherwise the variable will be blank -->
|
||||
<!-- BEGIN: Vendor JS-->
|
||||
@section('scripts')
|
||||
<!-- Core JS -->
|
||||
<!-- build:js assets/vendor/js/core.js -->
|
||||
<script src="{{ asset('assets') }}/vendor/libs/jquery/jquery.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/popper/popper.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/js/bootstrap.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/node-waves/node-waves.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/perfect-scrollbar/perfect-scrollbar.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/hammer/hammer.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/i18n/i18n.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/typeahead-js/typeahead.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/js/menu.js"></script>
|
||||
|
||||
</body>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
<!-- endbuild -->
|
||||
|
||||
$("#formValidationEmail").on('blur', function() {
|
||||
var email = $(this).val(); // 獲取電子郵件輸入框的值
|
||||
<!-- Vendors JS -->
|
||||
<script src="{{ asset('assets') }}/vendor/libs/select2/select2.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/bootstrap-select/bootstrap-select.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/moment/moment.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/flatpickr/flatpickr.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/tagify/tagify.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/@form-validation/popular.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/@form-validation/bootstrap5.js"></script>
|
||||
<script src="{{ asset('assets') }}/vendor/libs/@form-validation/auto-focus.js"></script>
|
||||
|
||||
// 簡單的電子郵件格式驗證(可選)
|
||||
if (!email.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)) {
|
||||
Swal.fire({
|
||||
icon: 'error'
|
||||
, title: '格式錯誤'
|
||||
, text: '請輸入有效的電子郵件地址!'
|
||||
});
|
||||
return;
|
||||
}
|
||||
<!-- Main JS -->
|
||||
<script src="../../assets/js/main.js"></script>
|
||||
|
||||
// 發送 AJAX 請求到伺服器進行進一步驗證
|
||||
$.ajax({
|
||||
url: "{{route('member.validemail')}}", // 替換成你的 API 路徑
|
||||
type: 'get', // 或 'GET',根據你的需求
|
||||
data: {
|
||||
email: email
|
||||
|
||||
|
||||
|
||||
<!-- Page JS -->
|
||||
<script src="../../assets/js/form-validation.js"></script>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#formValidationEmail").on('blur', function() {
|
||||
var email = $(this).val(); // 獲取電子郵件輸入框的值
|
||||
|
||||
// 簡單的電子郵件格式驗證(可選)
|
||||
if (!email.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)) {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: '格式錯誤',
|
||||
text: '請輸入有效的電子郵件地址!'
|
||||
});
|
||||
return;
|
||||
}
|
||||
, headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') // 如果使用 Laravel CSRF 保護
|
||||
}
|
||||
, success: function(response) {
|
||||
// 如果電子郵件已被註冊
|
||||
if (!response.valid) {
|
||||
|
||||
// 發送 AJAX 請求到伺服器進行進一步驗證
|
||||
$.ajax({
|
||||
url: "{{ route('member.validemail') }}", // 替換成你的 API 路徑
|
||||
type: 'get', // 或 'GET',根據你的需求
|
||||
data: {
|
||||
email: email
|
||||
},
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr(
|
||||
'content') // 如果使用 Laravel CSRF 保護
|
||||
},
|
||||
success: function(response) {
|
||||
// 如果電子郵件已被註冊
|
||||
if (!response.valid) {
|
||||
Swal.fire({
|
||||
icon: 'warning',
|
||||
title: '電子郵件已被註冊',
|
||||
text: '該電子郵件已存在,請選擇下一步操作。',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '驗證電子郵件',
|
||||
cancelButtonText: '我知道了,換一個',
|
||||
reverseButtons: true // 按鈕排列反向
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// 使用者選擇驗證電子郵件
|
||||
Swal.fire({
|
||||
icon: 'info',
|
||||
title: '驗證發送中',
|
||||
text: '已向該電子郵件發送驗證信,請檢查郵箱。'
|
||||
});
|
||||
// 可在此處調用發送驗證郵件的函式
|
||||
sendVerificationEmail(email);
|
||||
} else if (result.dismiss === Swal.DismissReason
|
||||
.cancel) {
|
||||
// 使用者選擇換一個電子郵件
|
||||
$('#formValidationEmail').val(''); // 清空輸入框
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: '電子郵件可用',
|
||||
text: '您可以繼續使用此電子郵件。'
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
// 錯誤處理
|
||||
Swal.fire({
|
||||
icon: 'warning'
|
||||
, title: '電子郵件已被註冊'
|
||||
, text: '該電子郵件已存在,請選擇下一步操作。'
|
||||
, showCancelButton: true
|
||||
, confirmButtonText: '驗證電子郵件'
|
||||
, cancelButtonText: '我知道了,換一個'
|
||||
, reverseButtons: true // 按鈕排列反向
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// 使用者選擇驗證電子郵件
|
||||
Swal.fire({
|
||||
icon: 'info'
|
||||
, title: '驗證發送中'
|
||||
, text: '已向該電子郵件發送驗證信,請檢查郵箱。'
|
||||
});
|
||||
// 可在此處調用發送驗證郵件的函式
|
||||
sendVerificationEmail(email);
|
||||
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
||||
// 使用者選擇換一個電子郵件
|
||||
$('#formValidationEmail').val(''); // 清空輸入框
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'success'
|
||||
, title: '電子郵件可用'
|
||||
, text: '您可以繼續使用此電子郵件。'
|
||||
icon: 'error',
|
||||
title: '伺服器錯誤',
|
||||
text: '驗證失敗,請稍後再試!'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
// 發送驗證郵件的函式
|
||||
function sendVerificationEmail(email) {
|
||||
console.log('email:', email);
|
||||
$.ajax({
|
||||
url: "{{ route('member.sendemail') }}", // 替換為發送驗證郵件的 API
|
||||
type: 'POST',
|
||||
data: {
|
||||
email: email
|
||||
},
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(Response) {
|
||||
console.log('Response:', Response);
|
||||
|
||||
if (Response.status == 'success') {
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: '驗證信已發送',
|
||||
text: '請檢查您的電子郵件以完成驗證。'
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
error: function() {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: '驗證信發送失敗',
|
||||
text: '請稍後再試!'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$('#editUserForm').on('submit', function(e) {
|
||||
e.preventDefault(); // 防止表單提交
|
||||
|
||||
let valid = true;
|
||||
|
||||
// Email 驗證
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
const emailInput = $('#formValidationEmail');
|
||||
if (!emailRegex.test(emailInput.val())) {
|
||||
valid = false;
|
||||
emailInput.addClass('is-invalid');
|
||||
} else {
|
||||
emailInput.removeClass('is-invalid');
|
||||
}
|
||||
, error: function(xhr) {
|
||||
// 錯誤處理
|
||||
Swal.fire({
|
||||
icon: 'error'
|
||||
, title: '伺服器錯誤'
|
||||
, text: '驗證失敗,請稍後再試!'
|
||||
|
||||
// 密碼長度驗證
|
||||
const passwordInput = $('#basic-default-password');
|
||||
//if (passwordInput.val().length < 6) {
|
||||
// valid = false;
|
||||
//passwordInput.addClass('is-invalid');
|
||||
//} else {
|
||||
// passwordInput.removeClass('is-invalid');
|
||||
//}
|
||||
|
||||
// 確認密碼驗證
|
||||
const confirmPasswordInput = $('#formValidationConfirmPass');
|
||||
if (passwordInput.val() !== confirmPasswordInput.val()) {
|
||||
valid = false;
|
||||
confirmPasswordInput.addClass('is-invalid');
|
||||
} else {
|
||||
confirmPasswordInput.removeClass('is-invalid');
|
||||
}
|
||||
|
||||
// 手機號碼驗證
|
||||
const phoneRegex = /^09\d{8}$/;
|
||||
const phoneInput = $('#modalEditUserPhone');
|
||||
if (!phoneRegex.test(phoneInput.val())) {
|
||||
valid = false;
|
||||
phoneInput.addClass('is-invalid');
|
||||
} else {
|
||||
phoneInput.removeClass('is-invalid');
|
||||
}
|
||||
|
||||
// 若通過所有驗證,發送 AJAX 請求
|
||||
if (valid) {
|
||||
const formData = {
|
||||
email: emailInput.val(),
|
||||
password: passwordInput.val(),
|
||||
phone: phoneInput.val(),
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: "{{ route('member.profile.update') }}",
|
||||
type: 'put',
|
||||
data: formData,
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(response) {
|
||||
Swal.fire({
|
||||
title: '成功',
|
||||
text: "{{ session('success') }}",
|
||||
icon: 'success',
|
||||
confirmButtonText: '确定'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// 跳轉到 member.index 路由
|
||||
window.location.href =
|
||||
"{{ route('member.index') }}";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
error: function(error) {
|
||||
Swal.fire({
|
||||
title: '失敗',
|
||||
text: "更新失敗",
|
||||
icon: 'error',
|
||||
confirmButtonText: '确定'
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
// 發送驗證郵件的函式
|
||||
function sendVerificationEmail(email) {
|
||||
console.log('email:', email);
|
||||
$.ajax({
|
||||
url: "{{route('member.sendemail')}}", // 替換為發送驗證郵件的 API
|
||||
type: 'POST'
|
||||
, data: {
|
||||
email: email
|
||||
}
|
||||
, headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
, success: function(Response) {
|
||||
console.log('Response:', Response);
|
||||
|
||||
if (Response.status == 'success') {
|
||||
Swal.fire({
|
||||
icon: 'success'
|
||||
, title: '驗證信已發送'
|
||||
, text: '請檢查您的電子郵件以完成驗證。'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
, error: function() {
|
||||
Swal.fire({
|
||||
icon: 'error'
|
||||
, title: '驗證信發送失敗'
|
||||
, text: '請稍後再試!'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$('#editUserForm').on('submit', function(e) {
|
||||
e.preventDefault(); // 防止表單提交
|
||||
|
||||
$("#cancel").on('click', function() {
|
||||
let valid = true;
|
||||
|
||||
// Email 驗證
|
||||
@ -294,98 +400,21 @@ function sendVerificationEmail(email) {
|
||||
} else {
|
||||
emailInput.removeClass('is-invalid');
|
||||
}
|
||||
|
||||
// 密碼長度驗證
|
||||
const passwordInput = $('#basic-default-password');
|
||||
//if (passwordInput.val().length < 6) {
|
||||
// valid = false;
|
||||
//passwordInput.addClass('is-invalid');
|
||||
//} else {
|
||||
// passwordInput.removeClass('is-invalid');
|
||||
//}
|
||||
|
||||
// 確認密碼驗證
|
||||
const confirmPasswordInput = $('#formValidationConfirmPass');
|
||||
if (passwordInput.val() !== confirmPasswordInput.val()) {
|
||||
valid = false;
|
||||
confirmPasswordInput.addClass('is-invalid');
|
||||
} else {
|
||||
confirmPasswordInput.removeClass('is-invalid');
|
||||
if (valid == true) {
|
||||
window.location.href = "{{ route('member.index') }}";
|
||||
}
|
||||
|
||||
// 手機號碼驗證
|
||||
const phoneRegex = /^09\d{8}$/;
|
||||
const phoneInput = $('#modalEditUserPhone');
|
||||
if (!phoneRegex.test(phoneInput.val())) {
|
||||
valid = false;
|
||||
phoneInput.addClass('is-invalid');
|
||||
} else {
|
||||
phoneInput.removeClass('is-invalid');
|
||||
}
|
||||
|
||||
// 若通過所有驗證,發送 AJAX 請求
|
||||
if (valid) {
|
||||
const formData = {
|
||||
email: emailInput.val()
|
||||
, password: passwordInput.val()
|
||||
, phone: phoneInput.val()
|
||||
, };
|
||||
|
||||
$.ajax({
|
||||
url: "{{ route('member.profile.update') }}"
|
||||
, type: 'put'
|
||||
, data: formData
|
||||
, headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
, success: function(response) {
|
||||
Swal.fire({
|
||||
title: '成功'
|
||||
, text: "{{ session('success') }}"
|
||||
, icon: 'success'
|
||||
, confirmButtonText: '确定'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
// 跳轉到 member.index 路由
|
||||
window.location.href = "{{ route('member.index') }}";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
, error: function(error) {
|
||||
Swal.fire({
|
||||
title: '失敗'
|
||||
, text: "更新失敗"
|
||||
, icon: 'error'
|
||||
, confirmButtonText: '确定'
|
||||
});
|
||||
}
|
||||
, });
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
$("#cancel").on('click', function() {
|
||||
let valid = true;
|
||||
<link rel="module" href="{{ asset('assets') }}/vendor/libs/@form-validation/popular.js" />
|
||||
|
||||
<script>
|
||||
$("#cancel").on('click', function() {
|
||||
|
||||
// Email 驗證
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
const emailInput = $('#formValidationEmail');
|
||||
if (!emailRegex.test(emailInput.val())) {
|
||||
valid = false;
|
||||
emailInput.addClass('is-invalid');
|
||||
} else {
|
||||
emailInput.removeClass('is-invalid');
|
||||
}
|
||||
if (valid == true) {
|
||||
window.location.href = "{{ route('member.index') }}";
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@endsection
|
||||
|
||||
@ -90,22 +90,20 @@
|
||||
<div class="d-flex">
|
||||
<div class="flex-shrink-0 me-2">
|
||||
<div class="avatar avatar-online">
|
||||
@if(isset(Auth::guard('member')->user()->avatar))
|
||||
<img src="{{ Auth::guard('member')->user()->avatar }}" alt class="rounded-circle" />
|
||||
@else
|
||||
<img src="../../assets/img/avatars/1.png" alt class="rounded-circle" />
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<span class="fw-medium d-block small">
|
||||
@if (Auth::guard('member')->check())
|
||||
{{Auth::guard('member')->user()->name}}
|
||||
@else
|
||||
{{Auth::user()->name}}
|
||||
@endif
|
||||
|
||||
</span>
|
||||
@if(Auth::guard('member')->check())
|
||||
<small class="text-muted">{{Auth::guard('member')->user()->Level_Name}}</small>
|
||||
@else
|
||||
<small class="text-muted">管理員</small>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
@ -150,19 +148,12 @@ class="align-middle">Pricing</span>
|
||||
<li>
|
||||
<div class="d-grid px-4 pt-2 pb-1">
|
||||
|
||||
@if (Auth::guard('member')->check())
|
||||
<a class="btn btn-sm btn-danger d-flex" href="{{route("member.logout")}}" target="_blank">
|
||||
<small class="align-middle">登 出</small>
|
||||
<i class="ri-logout-box-r-line ms-2 ri-16px"></i>
|
||||
</a>
|
||||
|
||||
@else
|
||||
<a class="btn btn-sm btn-danger d-flex" href="{{route("admin.logout")}}" target="_blank">
|
||||
<small class="align-middle">登 出</small>
|
||||
<i class="ri-logout-box-r-line ms-2 ri-16px"></i>
|
||||
</a>
|
||||
|
||||
@endif
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@ -40,10 +40,14 @@
|
||||
Route::get('email/password', [RegisterController::class, 'forgotPassword'])->name('email.password');
|
||||
Route::post('email/password', [RegisterController::class, 'sendForgotPassword'])->name('email.password.post');
|
||||
Route::get('resetpassword', [RegisterController::class, 'resetPassword'])->name('reset.password.token');
|
||||
Route::get('changepassword/{id}', [RegisterController::class, 'changePassword'])->name('change.password');
|
||||
Route::put('changepassword/{id}', [RegisterController::class, 'resetPasswordProcess'])->name('change.password.put');
|
||||
|
||||
Route::get('changepassword', [RegisterController::class, 'changePassword'])->name('change.password');
|
||||
Route::put('changepassword', [RegisterController::class, 'resetPasswordProcess'])->name('change.password.put');
|
||||
Route::any('checkphone', [MemberController::class, 'checkPhone'])->name('member.checkphone');
|
||||
Route::get('checkemail', [MemberController::class, 'checkEmail'])->name('member.checkemail');
|
||||
Route::get('google/auth', [LoginController::class, 'redirectToGoogle'])->name('google.auth');
|
||||
Route::get('google/callback', [LoginController::class, 'handleGoogleCallback'])->name('google.redirect');
|
||||
|
||||
|
||||
|
||||
|
||||
//前台route 登入後;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user