Skip to content

quick fixes #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
@@ -8,11 +8,12 @@
namespace App\Http\Controllers;


use App\Http\Requests\AuthLoginRequest;
use App\Http\Requests\AuthRegisterRequest;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Testing\Fluent\Concerns\Has;
use Illuminate\Validation\Rules\Password;

/**
* Class AuthController
@@ -22,17 +23,9 @@
*/
class AuthController extends Controller
{
public function register(Request $request)
public function register(AuthRegisterRequest $request)
{
$data = $request->validate([
'name' => 'required|string',
'email' => 'required|email|string|unique:users,email',
'password' => [
'required',
'confirmed',
Password::min(8)->mixedCase()->numbers()->symbols()
]
]);
$data = $request->validated();

/** @var \App\Models\User $user */
$user = User::create([
@@ -48,15 +41,9 @@ public function register(Request $request)
]);
}

public function login(Request $request)
public function login(AuthLoginRequest $request)
{
$credentials = $request->validate([
'email' => 'required|email|string|exists:users,email',
'password' => [
'required',
],
'remember' => 'boolean'
]);
$credentials = $request->validated();
$remember = $credentials['remember'] ?? false;
unset($credentials['remember']);

34 changes: 34 additions & 0 deletions app/Http/Requests/AuthLoginRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class AuthLoginRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email|string',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the following rule is missing exists:users,email

'password' => [
'required',
],
'remember' => 'boolean'
];
}
}
39 changes: 39 additions & 0 deletions app/Http/Requests/AuthRegisterRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules\Password;

class AuthRegisterRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return
[
'name' => 'required|string',
'email' => 'required|email|string|unique:users,email',
'password' => [
'required',
'confirmed',
Password::min(8)->mixedCase()->numbers()->symbols()
]

];
}
}
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -2,10 +2,13 @@
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"php": "^7.4|^8.0",
"ext-json": "*",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
1,996 changes: 171 additions & 1,825 deletions vue/package-lock.json

Large diffs are not rendered by default.

46 changes: 38 additions & 8 deletions vue/src/views/NotFound.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,45 @@
<template>
<div>
Page Not found
<div
class="bg-white min-h-full px-4 py-16 sm:px-6 sm:py-24 md:grid md:place-items-center lg:px-8"
>
<div class="max-w-max mx-auto">
<main class="sm:flex">
<p class="text-4xl font-extrabold text-indigo-600 sm:text-5xl">404</p>
<div class="sm:ml-6">
<div class="sm:border-l sm:border-gray-200 sm:pl-6">
<h1
class="text-4xl font-extrabold text-gray-900 tracking-tight sm:text-5xl"
>
Page not found
</h1>
<p class="mt-1 text-base text-gray-500">
Please check the URL in the address bar and try again.
</p>
</div>
<div
class="mt-10 flex space-x-3 sm:border-l sm:border-transparent sm:pl-6"
>
<a
href="#"
class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
>
Go back home
</a>
<a
href="#"
class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-indigo-700 bg-indigo-100 hover:bg-indigo-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
>
Contact support
</a>
</div>
</div>
</main>
</div>
</div>
</template>

<script>
export default {
}
export default {};
</script>

<style>
</style>
<style></style>