-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Maestro-ESEO/dev
Dev to Main
- Loading branch information
Showing
143 changed files
with
4,041 additions
and
2,216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
/.phpunit.cache | ||
/node_modules | ||
/public/build | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
.env | ||
.env.backup | ||
.env.production | ||
.phpunit.result.cache | ||
docker-compose.override.yml | ||
Homestead.json | ||
Homestead.yaml | ||
auth.json | ||
npm-debug.log | ||
yarn-error.log | ||
/.fleet | ||
/.idea | ||
/.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
php: | ||
preset: laravel | ||
version: 8 | ||
disabled: | ||
- no_unused_imports | ||
finder: | ||
not-name: | ||
- index.php | ||
- server.php | ||
js: | ||
finder: | ||
not-name: | ||
- webpack.mix.js | ||
css: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Http\Requests\LoginRequest; | ||
use App\Http\Requests\RegisterRequest; | ||
use App\Models\User; | ||
use Illuminate\Support\Facades\Auth; | ||
|
||
class AuthController extends Controller { | ||
|
||
public function show_login() { | ||
if (Auth::check()) { | ||
return redirect()->route('dashboard'); | ||
} | ||
return view('auth.login'); | ||
} | ||
|
||
public function show_register() { | ||
if (Auth::check()) { | ||
return redirect()->route('dashboard'); | ||
} | ||
return view('auth.register'); | ||
} | ||
|
||
public function login(LoginRequest $request) { | ||
$credentials = $request->validated(); | ||
|
||
$user = User::where('email', $credentials['email'])->first(); | ||
if (!$user || $user->password != $credentials['password']) { | ||
return redirect(route('auth.login'))->withErrors([ | ||
"email" => "The email or password is incorrect.", | ||
])->onlyInput('email'); | ||
} | ||
|
||
Auth::login($user); | ||
session()->regenerate(); | ||
return redirect()->intended(route('dashboard')); | ||
} | ||
|
||
public function register(RegisterRequest $request) { | ||
$credentials = $request->validated(); | ||
|
||
if (User::where('email', $credentials['email'])->exists()) { | ||
return redirect(route('auth.register'))->withErrors([ | ||
"email" => "The email is already taken.", | ||
])->onlyInput('email'); | ||
} | ||
$user = User::create([ | ||
'first_name' => $credentials['first_name'], | ||
'last_name' => $credentials['last_name'], | ||
'email' => $credentials['email'], | ||
'password' => $credentials['password'], | ||
]); | ||
if ($user == null) { | ||
return redirect(route('auth.register'))->withErrors([ | ||
'email' => "An error occurred while creating the user.", | ||
])->onlyInput('email'); | ||
} | ||
|
||
Auth::login($user); | ||
session()->regenerate(); | ||
return redirect()->intended(route('dashboard')); | ||
} | ||
|
||
public function logout() { | ||
Auth::logout(); | ||
return redirect()->route('auth.login'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Contracts\View\View; | ||
|
||
class DashboardController extends Controller { | ||
|
||
public function show(): View { | ||
return view('app.dashboard'); | ||
} | ||
|
||
} |
Oops, something went wrong.