forgot & reset password
This commit is contained in:
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\AuthMobile;
|
namespace App\Http\Controllers\AuthMobile;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use Auth;
|
||||||
|
use Carbon\Carbon;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\File;
|
use App\Models\File;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Carbon\Carbon;
|
|
||||||
use Auth;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
class AuthController extends Controller
|
class AuthController extends Controller
|
||||||
@@ -79,7 +79,7 @@ class AuthController extends Controller
|
|||||||
return response($response, 201);
|
return response($response, 201);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function login(Request $request) {
|
public function loginUser(Request $request) {
|
||||||
$fields = $request->validate([
|
$fields = $request->validate([
|
||||||
'username' => 'required|string',
|
'username' => 'required|string',
|
||||||
'password' => 'required|string'
|
'password' => 'required|string'
|
||||||
@@ -108,9 +108,11 @@ class AuthController extends Controller
|
|||||||
}
|
}
|
||||||
//Check Password
|
//Check Password
|
||||||
if(!$user || !Hash::check($fields['password'], $user->password)){
|
if(!$user || !Hash::check($fields['password'], $user->password)){
|
||||||
return response([
|
|
||||||
'message' => 'Bad Creds'
|
return $this->jsonResponse(null, trans('auth.failed'), 401);
|
||||||
], 401);
|
// return response([
|
||||||
|
// 'message' => 'Bad Creds'
|
||||||
|
// ], 401);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +125,7 @@ class AuthController extends Controller
|
|||||||
return response($response, 201);
|
return response($response, 201);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function logout(Request $request){
|
public function logoutUser(Request $request){
|
||||||
auth()->user()->tokens()->delete();
|
auth()->user()->tokens()->delete();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||||
|
|
||||||
|
class ResetPasswordController extends Controller
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Reset Controller
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This controller is responsible for handling password reset emails and
|
||||||
|
| includes a trait which assists in sending these notifications from
|
||||||
|
| your application to your users. Feel free to explore this trait.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
use SendsPasswordResetEmails;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('guest');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers\AuthMobile;
|
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Hash;
|
|
||||||
use Illuminate\Support\Facades\Password;
|
|
||||||
use Illuminate\Auth\Events\PasswordReset;
|
|
||||||
use Illuminate\Validation\Rules\Password as RulesPassword;
|
|
||||||
|
|
||||||
class NewPasswordController extends Controller
|
|
||||||
{
|
|
||||||
public function forgotPassword(Request $request){
|
|
||||||
|
|
||||||
$request->validation([
|
|
||||||
'email' => 'required|email'
|
|
||||||
]);
|
|
||||||
|
|
||||||
$status = User::sendResetLink(
|
|
||||||
$request->onlu('email')
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($status == User::RESET_LINK_SENT){
|
|
||||||
return [
|
|
||||||
'status' => __($status)
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
throw ValidationException::withMessage([
|
|
||||||
'email' => [trans($status)],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function reset(Request $request){
|
|
||||||
|
|
||||||
$request->validation([
|
|
||||||
'token' => 'required',
|
|
||||||
'email' => 'required|email',
|
|
||||||
'password' => ['required', 'confirmed', RulesPassword::defaults()],
|
|
||||||
]);
|
|
||||||
|
|
||||||
// $status = Password::reset(
|
|
||||||
// $request->only('email', 'password_confirmation', 'token')
|
|
||||||
// )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\AuthMobile;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ResetPasswordController extends Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Foundation\Auth\VerifiesEmails;
|
||||||
|
|
||||||
|
class VerificationController extends Controller
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Email Verification Controller
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This controller is responsible for handling email verification for any
|
||||||
|
| user that recently registered with the application. Emails may also
|
||||||
|
| be re-sent if the user didn't receive the original email message.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
use VerifiesEmails;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Where to redirect users after verification.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $redirectTo = '/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('auth');
|
||||||
|
$this->middleware('signed')->only('verify');
|
||||||
|
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Mobile;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Auth\Events\Verified;
|
||||||
|
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||||
|
|
||||||
|
class EmailVerificationController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
public function sendVerificationEmail(Request $request)
|
||||||
|
{
|
||||||
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
|
return [
|
||||||
|
'message' => 'Already Verified'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->user()->sendEmailVerificationNotification();
|
||||||
|
|
||||||
|
return ['status' => 'verification-link-sent'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function verify(EmailVerificationRequest $request)
|
||||||
|
{
|
||||||
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
|
return [
|
||||||
|
'message' => 'Email already verified'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->user()->markEmailAsVerified()) {
|
||||||
|
event(new Verified($request->user()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'message'=>'Email has been verified'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Mobile;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ForgotPasswordController extends Controller
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Reset Controller
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This controller is responsible for handling password reset emails and
|
||||||
|
| includes a trait which assists in sending these notifications from
|
||||||
|
| your application to your users. Feel free to explore this trait.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
use SendsPasswordResetEmails;
|
||||||
|
|
||||||
|
|
||||||
|
protected function sendResetLinkResponse(Request $request, $response)
|
||||||
|
{
|
||||||
|
return response(['message'=> $response]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function sendResetLinkFailedResponse(Request $request, $response)
|
||||||
|
{
|
||||||
|
return response(['error'=> $response], 422);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+4
-2
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers\AuthMobile;
|
namespace App\Http\Controllers\Mobile;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -24,7 +24,9 @@ class LelongMobileController extends Controller
|
|||||||
$currentdate = $currentdate->toDateString();
|
$currentdate = $currentdate->toDateString();
|
||||||
|
|
||||||
// $arrayLelong = [];
|
// $arrayLelong = [];
|
||||||
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)->where('sts_lelong','=',1)->get()->toArray();
|
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)
|
||||||
|
->where('sts_lelong','=',1)
|
||||||
|
->get()->toArray();
|
||||||
|
|
||||||
foreach($lelong as $index1=>$lel)
|
foreach($lelong as $index1=>$lel)
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers\AuthMobile;
|
namespace App\Http\Controllers\Mobile;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Mobile;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ResetPasswordController extends Controller
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Reset Controller
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This controller is responsible for handling password reset requests
|
||||||
|
| and uses a simple trait to include this behavior. You're free to
|
||||||
|
| explore this trait and override any methods you wish to tweak.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
use ResetsPasswords;
|
||||||
|
|
||||||
|
protected function sendResetResponse(Request $request, $response)
|
||||||
|
{
|
||||||
|
return response(['message'=> trans($response)]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function sendResetFailedResponse(Request $request, $response)
|
||||||
|
{
|
||||||
|
return response(['error'=> trans($response)], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers\AuthMobile;
|
namespace App\Http\Controllers\Mobile;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Mobile;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Auth\Events\Verified;
|
||||||
|
use Illuminate\Foundation\Auth\VerifiesEmails;
|
||||||
|
use Illuminate\Auth\Access\AuthorizationException;
|
||||||
|
|
||||||
|
class VerificationController extends Controller
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Email Verification Controller
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This controller is responsible for handling email verification for any
|
||||||
|
| user that recently registered with the application. Emails may also
|
||||||
|
| be re-sent if the user didn't receive the original email message.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
use VerifiesEmails;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Where to redirect users after verification.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $redirectTo = '/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('auth:api')->only('resend');
|
||||||
|
$this->middleware('signed')->only('verify');
|
||||||
|
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resend the email verification notification.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function resend(Request $request)
|
||||||
|
{
|
||||||
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
|
|
||||||
|
return response(['message'=>'Already verified']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->user()->sendEmailVerificationNotification();
|
||||||
|
|
||||||
|
if ($request->wantsJson()) {
|
||||||
|
return response(['message' => 'Email Sent']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return back()->with('resent', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mark the authenticated user's email address as verified.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||||
|
*/
|
||||||
|
public function verify(Request $request)
|
||||||
|
{
|
||||||
|
auth()->loginUsingId($request->route('id'));
|
||||||
|
|
||||||
|
if ($request->route('id') != $request->user()->getKey()) {
|
||||||
|
throw new AuthorizationException;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
|
|
||||||
|
return response(['message'=>'Already verified']);
|
||||||
|
|
||||||
|
// return redirect($this->redirectPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->user()->markEmailAsVerified()) {
|
||||||
|
event(new Verified($request->user()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return response(['message'=>'Successfully verified']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ class Authenticate extends Middleware
|
|||||||
protected function redirectTo($request)
|
protected function redirectTo($request)
|
||||||
{
|
{
|
||||||
if (! $request->expectsJson()) {
|
if (! $request->expectsJson()) {
|
||||||
return route('login');
|
return route('loginUser');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-4
@@ -2,12 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
||||||
use Spatie\Permission\Traits\HasRoles;
|
use Spatie\Permission\Traits\HasRoles;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Laravel\Sanctum\HasApiTokens;
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
|
use App\Notifications\PasswordResetNotification;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
@@ -58,4 +59,10 @@ class User extends Authenticatable
|
|||||||
protected $casts = [
|
protected $casts = [
|
||||||
'email_verified_at' => 'datetime',
|
'email_verified_at' => 'datetime',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function sendPasswordResetNotification($token)
|
||||||
|
{
|
||||||
|
$this->notify(new PasswordResetNotification($token));
|
||||||
|
// $user->notify(new PasswordResetNotification($user));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
use Illuminate\Support\Facades\Lang;
|
||||||
|
|
||||||
|
class PasswordResetNotification extends Notification
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
public $token;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new notification instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct($token)
|
||||||
|
{
|
||||||
|
$this->token = $token;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via($notifiable)
|
||||||
|
{
|
||||||
|
return ['mail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mail representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail($notifiable)
|
||||||
|
{
|
||||||
|
$urlToResetForm = "http://localhost:8000/api/password/reset?token=". $this->token;
|
||||||
|
return (new MailMessage)
|
||||||
|
->subject(Lang::get('Hey! Reset Password Notification'))
|
||||||
|
->line(Lang::get('You requested here you go!'))
|
||||||
|
->action(Lang::get('Reset Password'), $urlToResetForm)
|
||||||
|
->line(Lang::get('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.users.expire')]))
|
||||||
|
->line(Lang::get('If you did not request a password reset, no further action is required. Token: ==>'. $this->token));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the array representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($notifiable)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
use Illuminate\Auth\Notifications\VerifyEmail;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
class AuthServiceProvider extends ServiceProvider
|
class AuthServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@@ -25,6 +27,15 @@ class AuthServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
$this->registerPolicies();
|
$this->registerPolicies();
|
||||||
|
|
||||||
//
|
VerifyEmail::toMailUsing(function ($notifiable, $url) {
|
||||||
|
$Url = "http://localhost:8000/api?email_verify_url=".$url;
|
||||||
|
|
||||||
|
return (new MailMessage)
|
||||||
|
->subject('Verify Email Address')
|
||||||
|
->line('Click the button below to verify your email address.')
|
||||||
|
->action('Verify Email Address', $Url);
|
||||||
|
// ->action('Verify Email Address', $spaUrl);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+208
-73
@@ -4,81 +4,45 @@ return [
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Default Mailer
|
| Mail Driver
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| This option controls the default mailer that is used to send any email
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
|
||||||
| messages sent by your application. Alternative mailers may be setup
|
| sending of e-mail. You may specify which one you're using throughout
|
||||||
| and used as needed; however, this mailer will be used by default.
|
| your application here. By default, Laravel is setup for SMTP mail.
|
||||||
|
|
|
||||||
|
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
|
||||||
|
| "sparkpost", "postmark", "log", "array"
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('MAIL_MAILER', 'smtp'),
|
'driver' => env('MAIL_DRIVER', 'smtp'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Mailer Configurations
|
| SMTP Host Address
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Here you may configure all of the mailers used by your application plus
|
| Here you may provide the host address of the SMTP server used by your
|
||||||
| their respective settings. Several examples have been configured for
|
| applications. A default option is provided that is compatible with
|
||||||
| you and you are free to add your own as your application requires.
|
| the Mailgun mail service which will provide reliable deliveries.
|
||||||
|
|
|
||||||
| Laravel supports a variety of mail "transport" drivers to be used while
|
|
||||||
| sending an e-mail. You will specify which one you are using for your
|
|
||||||
| mailers below. You are free to add additional mailers as required.
|
|
||||||
|
|
|
||||||
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
|
||||||
| "postmark", "log", "array", "failover"
|
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'mailers' => [
|
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||||
'smtp' => [
|
|
||||||
'transport' => 'smtp',
|
|
||||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
|
||||||
'port' => env('MAIL_PORT', 587),
|
|
||||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
|
||||||
'username' => env('MAIL_USERNAME'),
|
|
||||||
'password' => env('MAIL_PASSWORD'),
|
|
||||||
'timeout' => null,
|
|
||||||
'auth_mode' => null,
|
|
||||||
],
|
|
||||||
|
|
||||||
'ses' => [
|
/*
|
||||||
'transport' => 'ses',
|
|--------------------------------------------------------------------------
|
||||||
],
|
| SMTP Host Port
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This is the SMTP port used by your application to deliver e-mails to
|
||||||
|
| users of the application. Like the host we have set this value to
|
||||||
|
| stay compatible with the Mailgun e-mail application by default.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
'mailgun' => [
|
'port' => env('MAIL_PORT', 587),
|
||||||
'transport' => 'mailgun',
|
|
||||||
],
|
|
||||||
|
|
||||||
'postmark' => [
|
|
||||||
'transport' => 'postmark',
|
|
||||||
],
|
|
||||||
|
|
||||||
'sendmail' => [
|
|
||||||
'transport' => 'sendmail',
|
|
||||||
'path' => '/usr/sbin/sendmail -bs',
|
|
||||||
],
|
|
||||||
|
|
||||||
'log' => [
|
|
||||||
'transport' => 'log',
|
|
||||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
|
||||||
],
|
|
||||||
|
|
||||||
'array' => [
|
|
||||||
'transport' => 'array',
|
|
||||||
],
|
|
||||||
|
|
||||||
'failover' => [
|
|
||||||
'transport' => 'failover',
|
|
||||||
'mailers' => [
|
|
||||||
'smtp',
|
|
||||||
'log',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -90,25 +54,53 @@ return [
|
|||||||
| used globally for all e-mails that are sent by your application.
|
| used globally for all e-mails that are sent by your application.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'stream'=>[
|
|
||||||
|
|
||||||
'ssl'=>[
|
|
||||||
|
|
||||||
'allow_self_signed'=>true,
|
|
||||||
|
|
||||||
'verify_peer'=>false,
|
|
||||||
|
|
||||||
'verify_peer_name'=>false,
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
'from' => [
|
'from' => [
|
||||||
'address' => env('MAIL_FROM_ADDRESS', 'aliaafqh44@gmail.com'),
|
'address' => env('MAIL_FROM_ADDRESS', 'aliaafqh44@gmail.com'),
|
||||||
'name' => env('MAIL_FROM_NAME', 'Lelong'),
|
'name' => env('MAIL_FROM_NAME', 'Lelong'),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| E-Mail Encryption Protocol
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the encryption protocol that should be used when
|
||||||
|
| the application send e-mail messages. A sensible default using the
|
||||||
|
| transport layer security protocol should provide great security.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| SMTP Server Username
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If your SMTP server requires a username for authentication, you should
|
||||||
|
| set it here. This will get used to authenticate with your server on
|
||||||
|
| connection. You may also set the "password" value below this one.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'username' => env('MAIL_USERNAME'),
|
||||||
|
|
||||||
|
'password' => env('MAIL_PASSWORD'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Sendmail System Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the "sendmail" driver to send e-mails, we will need to know
|
||||||
|
| the path to where Sendmail lives on this server. A default path has
|
||||||
|
| been provided here, which will work well on most of your systems.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'sendmail' => '/usr/sbin/sendmail -bs',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Markdown Mail Settings
|
| Markdown Mail Settings
|
||||||
@@ -128,4 +120,147 @@ return [
|
|||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Log Channel
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you are using the "log" driver, you may specify the logging channel
|
||||||
|
| if you prefer to keep mail messages separate from other log entries
|
||||||
|
| for simpler reading. Otherwise, the default channel will be used.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'log_channel' => env('MAIL_LOG_CHANNEL'),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Mailer
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default mailer that is used to send any email
|
||||||
|
| messages sent by your application. Alternative mailers may be setup
|
||||||
|
| and used as needed; however, this mailer will be used by default.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 'default' => env('MAIL_MAILER', 'smtp'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Mailer Configurations
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure all of the mailers used by your application plus
|
||||||
|
| their respective settings. Several examples have been configured for
|
||||||
|
| you and you are free to add your own as your application requires.
|
||||||
|
|
|
||||||
|
| Laravel supports a variety of mail "transport" drivers to be used while
|
||||||
|
| sending an e-mail. You will specify which one you are using for your
|
||||||
|
| mailers below. You are free to add additional mailers as required.
|
||||||
|
|
|
||||||
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
||||||
|
| "postmark", "log", "array", "failover"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 'mailers' => [
|
||||||
|
// 'smtp' => [
|
||||||
|
// 'transport' => 'smtp',
|
||||||
|
// 'host' => env('MAIL_HOST', 'smtp.mailtrap.io'),
|
||||||
|
// 'port' => env('MAIL_PORT', 587),
|
||||||
|
// 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||||
|
// 'username' => env('MAIL_USERNAME'),
|
||||||
|
// 'password' => env('MAIL_PASSWORD'),
|
||||||
|
// 'timeout' => null,
|
||||||
|
// 'auth_mode' => null,
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// 'ses' => [
|
||||||
|
// 'transport' => 'ses',
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// 'mailgun' => [
|
||||||
|
// 'transport' => 'mailgun',
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// 'postmark' => [
|
||||||
|
// 'transport' => 'postmark',
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// 'sendmail' => [
|
||||||
|
// 'transport' => 'sendmail',
|
||||||
|
// 'path' => '/usr/sbin/sendmail -bs',
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// 'log' => [
|
||||||
|
// 'transport' => 'log',
|
||||||
|
// 'channel' => env('MAIL_LOG_CHANNEL'),
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// 'array' => [
|
||||||
|
// 'transport' => 'array',
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// 'failover' => [
|
||||||
|
// 'transport' => 'failover',
|
||||||
|
// 'mailers' => [
|
||||||
|
// 'smtp',
|
||||||
|
// 'log',
|
||||||
|
// ],
|
||||||
|
// ],
|
||||||
|
// ],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Global "From" Address
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| You may wish for all e-mails sent by your application to be sent from
|
||||||
|
| the same address. Here, you may specify a name and address that is
|
||||||
|
| used globally for all e-mails that are sent by your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
// 'stream'=>[
|
||||||
|
|
||||||
|
// 'ssl'=>[
|
||||||
|
|
||||||
|
// 'allow_self_signed'=>true,
|
||||||
|
|
||||||
|
// 'verify_peer'=>false,
|
||||||
|
|
||||||
|
// 'verify_peer_name'=>false,
|
||||||
|
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// 'from' => [
|
||||||
|
// 'address' => env('MAIL_FROM_ADDRESS', 'aliaafqh44@gmail.com'),
|
||||||
|
// 'name' => env('MAIL_FROM_NAME', 'Lelong'),
|
||||||
|
// ],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Markdown Mail Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you are using Markdown based email rendering, you may configure your
|
||||||
|
| theme and component paths here, allowing you to customize the design
|
||||||
|
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 'markdown' => [
|
||||||
|
// 'theme' => 'default',
|
||||||
|
|
||||||
|
// 'paths' => [
|
||||||
|
// resource_path('views/vendor/mail'),
|
||||||
|
// ],
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// ];
|
||||||
|
|||||||
+8
-7
@@ -3,8 +3,10 @@
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use App\Http\Controllers\AuthMobile\AuthController;
|
use App\Http\Controllers\AuthMobile\AuthController;
|
||||||
use App\Http\Controllers\AuthMobile\UserController;
|
use App\Http\Controllers\Mobile\UserController;
|
||||||
use App\Http\Controllers\AuthMobile\LelongMobileController;
|
use App\Http\Controllers\Mobile\LelongMobileController;
|
||||||
|
use App\Http\Controllers\Mobile\ForgotPasswordController;
|
||||||
|
use App\Http\Controllers\Mobile\ResetPasswordController;
|
||||||
use App\Http\Controllers\CartController;
|
use App\Http\Controllers\CartController;
|
||||||
use App\Http\Controllers\ApiController;
|
use App\Http\Controllers\ApiController;
|
||||||
|
|
||||||
@@ -21,10 +23,10 @@ use App\Http\Controllers\ApiController;
|
|||||||
|
|
||||||
//Public routes
|
//Public routes
|
||||||
Route::post('/register', [AuthController::class, 'register']);
|
Route::post('/register', [AuthController::class, 'register']);
|
||||||
Route::post('/login', [AuthController::class, 'login']);
|
Route::post('/user/login', [AuthController::class, 'loginUser']);
|
||||||
Route::post('/forgotpassword', [ResetPassword::class, 'forgotpassword']);
|
|
||||||
Route::post('/addToCart', [CartController::class, 'addToCart']);
|
Route::post('/addToCart', [CartController::class, 'addToCart']);
|
||||||
Route::get('/cart/{userid}', [CartController::class, 'getCart']);
|
Route::get('/cart/{userid}', [CartController::class, 'getCart']);
|
||||||
|
Route::post('/password/email', [ForgotPasswordController::class, 'sendResetLinkEmail']);
|
||||||
|
|
||||||
// Route::post('/feepayment', [ApiController::class, 'feepayment']);
|
// Route::post('/feepayment', [ApiController::class, 'feepayment']);
|
||||||
// Route::get('/callback', [ApiController::class, 'feepayment']);
|
// Route::get('/callback', [ApiController::class, 'feepayment']);
|
||||||
@@ -37,10 +39,9 @@ Route::get('/pembayaran/backend', [ApiController::class, 'callback'])->name('pa
|
|||||||
Route::group(['middleware' => ['auth:sanctum']], function () {
|
Route::group(['middleware' => ['auth:sanctum']], function () {
|
||||||
|
|
||||||
// User
|
// User
|
||||||
Route::post('/logout', [AuthController::class, 'logout']);
|
Route::post('/user/logout', [AuthController::class, 'logoutUser']);
|
||||||
Route::get('/user/profile/{nokp}', [UserController::class, 'getProfileUser']);
|
Route::get('/user/profile/{nokp}', [UserController::class, 'getProfileUser']);
|
||||||
Route::post('/forgotPassword', [NewPasswordController::class, 'forgotPassword']);
|
Route::post('/password/reset', [ResetPasswordController::class, 'reset']);
|
||||||
Route::post('/reset', [NewPasswordController::class, 'reset']);
|
|
||||||
|
|
||||||
// User Profile
|
// User Profile
|
||||||
Route::get('/user/profile', [UserController::class, 'getProfileUser']);
|
Route::get('/user/profile', [UserController::class, 'getProfileUser']);
|
||||||
|
|||||||
Reference in New Issue
Block a user