Correcion loginController
This commit is contained in:
parent
e639083512
commit
e62d40a220
@ -2,14 +2,9 @@
|
||||
|
||||
namespace App\Http\Controllers\api;
|
||||
|
||||
use App\Http\Controllers\Controller;;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Laravel\Socialite\Facades\Socialite;
|
||||
use App\Models\User;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
|
@ -7,10 +7,12 @@
|
||||
use App\Models\User;
|
||||
use App\Models\Estandar;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function register(Request $request){
|
||||
public function register(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'email' => 'required|email|unique:users'
|
||||
]);
|
||||
@ -27,17 +29,16 @@ public function register(Request $request){
|
||||
'message' => 'Correo registrado exitosamente',
|
||||
'userAuth' => $user,
|
||||
]);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
return response()->json([
|
||||
"status" => 0,
|
||||
"message" => "Correo no registrado",
|
||||
], 404);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function login(Request $request){
|
||||
public function login(Request $request)
|
||||
{
|
||||
|
||||
$request->validate([
|
||||
"email" => "required|email",
|
||||
@ -60,7 +61,6 @@ public function login(Request $request){
|
||||
"message" => "La password es incorrecta",
|
||||
], 404);
|
||||
}
|
||||
|
||||
} else {
|
||||
return response()->json([
|
||||
"status" => 0,
|
||||
@ -69,7 +69,8 @@ public function login(Request $request){
|
||||
}
|
||||
}
|
||||
|
||||
public function userProfile(){
|
||||
public function userProfile()
|
||||
{
|
||||
return response()->json([
|
||||
"status" => 0,
|
||||
"message" => "Perfil de usuario",
|
||||
@ -77,12 +78,11 @@ public function userProfile(){
|
||||
]);
|
||||
}
|
||||
|
||||
public function logout(){
|
||||
public function logout()
|
||||
{
|
||||
auth()->user()->tokens()->delete();
|
||||
return response()->json([
|
||||
"status" => 1,
|
||||
"message" => "Cierre de Sesión",
|
||||
"message" => "Sesion cerrada"
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
26
composer.lock
generated
26
composer.lock
generated
@ -478,23 +478,23 @@
|
||||
},
|
||||
{
|
||||
"name": "doctrine/inflector",
|
||||
"version": "2.0.5",
|
||||
"version": "2.0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/inflector.git",
|
||||
"reference": "ade2b3bbfb776f27f0558e26eed43b5d9fe1b392"
|
||||
"reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/inflector/zipball/ade2b3bbfb776f27f0558e26eed43b5d9fe1b392",
|
||||
"reference": "ade2b3bbfb776f27f0558e26eed43b5d9fe1b392",
|
||||
"url": "https://api.github.com/repos/doctrine/inflector/zipball/d9d313a36c872fd6ee06d9a6cbcf713eaa40f024",
|
||||
"reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^9",
|
||||
"doctrine/coding-standard": "^10",
|
||||
"phpstan/phpstan": "^1.8",
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
"phpstan/phpstan-strict-rules": "^1.3",
|
||||
@ -549,7 +549,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/doctrine/inflector/issues",
|
||||
"source": "https://github.com/doctrine/inflector/tree/2.0.5"
|
||||
"source": "https://github.com/doctrine/inflector/tree/2.0.6"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -565,7 +565,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-09-07T09:01:28+00:00"
|
||||
"time": "2022-10-20T09:10:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/lexer",
|
||||
@ -1317,16 +1317,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v9.36.3",
|
||||
"version": "v9.36.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "80ba0561b3682b96743e1c152fde0698bbdb2412"
|
||||
"reference": "15ce569fd93124e8e2257c24e3ed85b9ef9951d6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/80ba0561b3682b96743e1c152fde0698bbdb2412",
|
||||
"reference": "80ba0561b3682b96743e1c152fde0698bbdb2412",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/15ce569fd93124e8e2257c24e3ed85b9ef9951d6",
|
||||
"reference": "15ce569fd93124e8e2257c24e3ed85b9ef9951d6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1338,7 +1338,7 @@
|
||||
"fruitcake/php-cors": "^1.2",
|
||||
"laravel/serializable-closure": "^1.2.2",
|
||||
"league/commonmark": "^2.2",
|
||||
"league/flysystem": "^3.0.16",
|
||||
"league/flysystem": "^3.8.0",
|
||||
"monolog/monolog": "^2.0",
|
||||
"nesbot/carbon": "^2.62.1",
|
||||
"nunomaduro/termwind": "^1.13",
|
||||
@ -1499,7 +1499,7 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2022-10-19T13:23:53+00:00"
|
||||
"time": "2022-10-20T16:11:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/sanctum",
|
||||
|
Loading…
Reference in New Issue
Block a user