| Server IP : 139.59.63.204 / Your IP : 216.73.217.62 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu-s-1vcpu-1gb-blr1-01 6.8.0-110-generic #110-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 19 15:09:20 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/customerportal/routes/ |
Upload File : |
<?php
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\Portal\LoginController;
use App\Http\Controllers\Portal\RegisterController;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Auth\AuthenticatedSessionController;
use App\Http\Controllers\Auth\ConfirmablePasswordController;
use App\Http\Controllers\Auth\EmailVerificationNotificationController;
use App\Http\Controllers\Auth\EmailVerificationPromptController;
use App\Http\Controllers\Auth\NewPasswordController;
use App\Http\Controllers\Auth\PasswordController;
use App\Http\Controllers\Auth\PasswordResetLinkController;
use App\Http\Controllers\Auth\RegisteredUserController;
use App\Http\Controllers\Auth\VerifyEmailController;
use Illuminate\Http\Request;
use Google\Client as GoogleClient;
use Google\Service\Gmail as GoogleServiceGmail;
use Google\Service\Gmail\Message as GoogleGmailMessage;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
/*Route::get('/', function () {
return view('welcome');
});*/
Route::get('register', [RegisterController::class, 'showRegister'])->name('portal.register');
Route::post('register', [RegisterController::class, 'submitRegister'])->name('portal.register.submit');
Route::get('/', [LoginController::class, 'showLogin'])->name('portal.login');
Route::post('login', [LoginController::class, 'submitLogin'])->name('portal.login.submit');
Route::post('logout', [LoginController::class, 'logout'])->name('portal.logout');
Route::post('/forgot-password-send', [LoginController::class, 'sendforgotpass'])->name('portal.forgetpass.send');
Route::get('/forgot-password', function () {
return view('portal.forgotpassword');
})->name('portal.forgotpassword');
Route::get('generatepass/{code}', [LoginController::class, 'generatepass'])->name('portal.generatepass');
Route::middleware('portal.auth')->group(function () {
Route::get('dashboard', fn() => view('portal.dashboard'))->name('portal.dashboard');
Route::post('change-password', [LoginController::class, 'changepassword'])->name('portal.password');
});
/*Route::get('/dashboard', function () {
return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');
*/
Route::middleware('auth')->group(function () {
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
Route::get('/products', function () {
return view('products');
})->name('products');
Route::get('/register-products', function () {
return view('registerproducts');
})->name('products.register');
Route::get('/product/{id}', function ($id) {
return view('product', ['id' => $id]);
})->name('productsx');
Route::get('/replacement/{id}', function ($id) {
return view('replacement', ['id' => $id]);
})->name('replacement');
Route::get('/paidreplacement/{id}', function ($id) {
return view('paidreplacement', ['id' => $id]);
})->name('paidreplacement');
Route::get('/tickets', function () {
return view('tickets');
})->name('tickets');
Route::get('/myticket/{id}', function ($id) {
return view('ticketdetail', ['id' => $id]);
})->name('mytickets');
});
Route::get('/auth/google', function () {
$client = new GoogleClient();
$client->setAuthConfig(storage_path('app/credentials.json'));
$client->addScope("https://www.googleapis.com/auth/gmail.send");
$client->setAccessType('offline');
$client->setPrompt('consent');
$client->setRedirectUri(route('oauth.callback'));
return redirect($client->createAuthUrl());
});
Route::get('/auth/google/callback', function (Request $request) {
$client = new GoogleClient();
$client->setAuthConfig(storage_path('app/credentials.json'));
$client->setRedirectUri(route('oauth.callback'));
$client->addScope("https://www.googleapis.com/auth/gmail.send");
$token = $client->fetchAccessTokenWithAuthCode($request->code);
file_put_contents(storage_path('app/token.json'), json_encode($token));
return 'Token saved successfully!';
})->name('oauth.callback');
Route::get('/send-gmail', function () {
$client = new GoogleClient();
$client->setAuthConfig(storage_path('app/credentials.json'));
$client->addScope("https://www.googleapis.com/auth/gmail.send");
$token = json_decode(file_get_contents(storage_path('app/token.json')), true);
$client->setAccessToken($token);
// Refresh token if expired
if ($client->isAccessTokenExpired()) {
$client->fetchAccessTokenWithRefreshToken($client->getRefreshToken());
file_put_contents(storage_path('app/token.json'), json_encode($client->getAccessToken()));
}
$service = new GoogleServiceGmail($client);
$templateData = [
'subject' => 'Welcome to Aquatech Corporation Warranty Portal',
'title' => 'Welcome Ankush Awasthi!',
'body' => '<p>Thank you for registering with Aquatech Corporation. We are excited to have you on board!</p><p>Your account has been successfully created, and you can now access our warranty services and support.</p><p>If you have any questions or need assistance, feel free to reach out to our support team.</p><p>Best regards,<br/>Aquatech Corporation Team</p>',
];
$htmlBody = view('emails.welcome', $templateData)->render();
// Build raw message
$rawMessage = "From: info@efbtechnology.com\r\n";
$rawMessage .= "To: awasthideepa15@gmail.com\r\n";
$rawMessage .= "Subject: {$templateData['subject']}\r\n";
$rawMessage .= "MIME-Version: 1.0\r\n";
$rawMessage .= "Content-Type: text/html; charset=UTF-8\r\n\r\n";
$rawMessage .= $htmlBody;
// Encode in base64url for Gmail API
$encodedMessage = base64_encode($rawMessage);
$encodedMessage = strtr($encodedMessage, ['+' => '-', '/' => '_', '=' => '']);
// Create Gmail message
$message = new GoogleGmailMessage();
$message->setRaw($encodedMessage);
// Send email
$service->users_messages->send('me', $message);
return 'Email sent successfully!';
});
Route::middleware('auth')->group(function () {
Route::get('verify-email', EmailVerificationPromptController::class)
->name('verification.notice');
Route::get('verify-email/{id}/{hash}', VerifyEmailController::class)
->middleware(['signed', 'throttle:6,1'])
->name('verification.verify');
Route::post('email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
->middleware('throttle:6,1')
->name('verification.send');
Route::get('confirm-password', [ConfirmablePasswordController::class, 'show'])
->name('password.confirm');
Route::post('confirm-password', [ConfirmablePasswordController::class, 'store']);
Route::put('password', [PasswordController::class, 'update'])->name('password.update');
/*
Route::post('logout', [AuthenticatedSessionController::class, 'destroy'])
->name('logout'); */
});
//require __DIR__.'/auth.php';