update
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Auth;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
use App\Models\User;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
@@ -27,4 +28,13 @@ class ResetPasswordController extends Controller
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
// protected function redirectTo(){
|
||||
|
||||
// if(Auth()->user()->role == 1 ){
|
||||
// return route('admin.dashboard');
|
||||
// }
|
||||
// elseif(Auth()->user->role == 2 ){
|
||||
// return route('user.dashboard');
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
+1
-1
@@ -102,4 +102,4 @@ class AuthController extends Controller
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
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')
|
||||
// )
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,8 @@ class User extends Authenticatable
|
||||
'register_agree',
|
||||
'front_img_path',
|
||||
'back_img_path',
|
||||
'disahkan_pada',
|
||||
'disahkan_oleh'
|
||||
|
||||
];
|
||||
|
||||
|
||||
+15
-2
@@ -90,10 +90,23 @@ return [
|
||||
| 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', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'aliaafqh44@gmail.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Lelong'),
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
@@ -25,15 +25,17 @@ class CreateUsersTable extends Migration
|
||||
$table->string('notelbimbit')->nullable();
|
||||
$table->string('note')->nullable();
|
||||
$table->string('status')->nullable();
|
||||
$table->timestamp('t_daftar')->nullable();
|
||||
$table->datetime('t_daftar')->nullable();
|
||||
$table->integer('online')->nullable();
|
||||
$table->integer('register_agree')->nullable();
|
||||
$table->string('username')->unique();
|
||||
$table->string('email')->nullable();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->datetime('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->string('front_img_path');
|
||||
$table->string('back_img_path');
|
||||
$table->datetime('disahkan_pada');
|
||||
$table->datetime('disahkan_oleh');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
@@ -18,6 +18,7 @@ use App\Http\Controllers\AuthController;
|
||||
//Public routes
|
||||
Route::post('/register', [AuthController::class, 'register']);
|
||||
Route::post('/login', [AuthController::class, 'login']);
|
||||
Route::post('/forgotpassword', [ResetPassword::class, 'forgotpassword']);
|
||||
|
||||
//Protected routes
|
||||
Route::group(['middleware' => ['auth:sanctum']], function () {
|
||||
|
||||
Reference in New Issue
Block a user