dependencies-upgrade

This commit is contained in:
RafficMohammed
2023-01-08 02:20:59 +05:30
parent 7870479b18
commit 49021a4497
1711 changed files with 74994 additions and 70803 deletions

View File

@@ -1,125 +0,0 @@
# Release Notes
## [Unreleased](https://github.com/laravel/ui/compare/v2.5.0...2.x)
## [v2.5.0 (2020-11-03)](https://github.com/laravel/ui/compare/v2.4.1...v2.5.0)
### Added
- PHP 8 Support ([#179](https://github.com/laravel/ui/pull/179))
## [v2.4.1 (2020-09-22)](https://github.com/laravel/ui/compare/v2.4.0...v2.4.1)
### Changed
- Revert "Add namespace check to Auth routes" ([#160](https://github.com/laravel/ui/pull/160))
## [v2.4.0 (2020-09-11)](https://github.com/laravel/ui/compare/v2.3.0...v2.4.0)
### Removed
- Remove Laravel 8 support ([#154](https://github.com/laravel/ui/pull/154))
### Fixed
- Fix Bootstrap preset ([#146](https://github.com/laravel/ui/pull/146))
## [v2.3.0 (2020-09-09)](https://github.com/laravel/ui/compare/v2.2.1...v2.3.0)
### Fixed
- Add namespace check to Auth routes ([#143](https://github.com/laravel/ui/pull/143))
## [v2.2.1 (2020-09-08)](https://github.com/laravel/ui/compare/v2.2.0...v2.2.1)
### Fixed
- Use proper json responses ([#139](https://github.com/laravel/ui/pull/139))
- Ensure sass directory exists ([456daa3](https://github.com/laravel/ui/commit/456daa330a32483b0fa9794334e60af6b2db3bf6))
## [v2.2.0 (2020-08-25)](https://github.com/laravel/ui/compare/v2.1.0...v2.2.0)
### Added
- Laravel 8 support ([4a0db5b](https://github.com/laravel/ui/commit/4a0db5b2e5d3c032b0f213e847008d39c8c7ce45))
### Fixed
- Remove caret and replace `display: none` with `d-none` ([#135](https://github.com/laravel/ui/pull/135))
## [v2.1.0 (2020-06-30)](https://github.com/laravel/ui/compare/v2.0.3...v2.1.0)
### Added
- Allow for optional login and logout routes ([#113](https://github.com/laravel/ui/pull/113))
### Fixed
- Missed localizable strings ([#105](https://github.com/laravel/ui/pull/105))
## [v2.0.3 (2020-04-29)](https://github.com/laravel/ui/compare/v2.0.2...v2.0.3)
### Fixed
- Fix confirm controller overwrite ([#100](https://github.com/laravel/ui/pull/100))
## [v2.0.2 (2020-04-28)](https://github.com/laravel/ui/compare/v2.0.1...v2.0.2)
### Fixed
- Confirm controller overwrite ([#95](https://github.com/laravel/ui/pull/95))
## [v2.0.1 (2020-03-03)](https://github.com/laravel/ui/compare/v2.0.0...v2.0.1)
### Fixed
- Make `auth` options empty by default ([47a0a1d](https://github.com/laravel/ui/commit/47a0a1dac76f5e73803c86e1f38b2c7e0ae7fa83))
## [v2.0.0 (2020-03-03)](https://github.com/laravel/ui/compare/v1.2.0...v2.0.0)
### Changed
- The UI package now contains all auth scaffolding from the laravel skeleton
## [v1.2.0 (2020-02-18)](https://github.com/laravel/ui/compare/v1.1.2...v1.2.0)
### Changed
- Use `sass-loader` v8 for Vue preset ([bb64fca](https://github.com/laravel/ui/commit/bb64fca681566ca94457d490a00f899516e75664))
## [v1.1.2 (2019-10-20)](https://github.com/laravel/ui/compare/v1.1.1...v1.1.2)
### Changed
- Removed Laravel 7.0 support ([0287d4ee](https://github.com/laravel/ui/commit/0287d4eee80aad718bdf7f90117cfe720c493064))
## [v1.1.1 (2019-10-11)](https://github.com/laravel/ui/compare/v1.1.0...v1.1.1)
### Changed
- Change the specified time until re-authentication ([#37](https://github.com/laravel/ui/pull/37))
### Fixed
- Add `auth.passwords.confirm` to exported views ([#36](https://github.com/laravel/ui/pull/36))
## [v1.1.0 (2019-10-08)](https://github.com/laravel/ui/compare/v1.0.1...v1.1.0)
### Added
- Add password confirmation screen ([#34](https://github.com/laravel/ui/pull/34))
### Changed
- Remove X-CSRF-TOKEN header from Axios instance ([#23](https://github.com/laravel/ui/pull/23))
### Fixed
- Replace tab to space ([#28](https://github.com/laravel/ui/pull/28))
- Add missing semicolon to avoid unnecessary diff ([#32](https://github.com/laravel/ui/pull/32))
- Update resolve-url-loader dependency constraint ([#33](https://github.com/laravel/ui/pull/33))
## [v1.0.1 (2019-09-02)](https://github.com/laravel/ui/compare/v1.0.0...v1.0.1)
### Added
- Add macro check on ui:auth command ([#16](https://github.com/laravel/ui/pull/16))
## v1.0.0 (2019-08-13)
Initial commit.

View File

@@ -1,20 +1,150 @@
# Laravel UI
<a href="https://packagist.org/packages/laravel/ui"><img src="https://poser.pugx.org/laravel/ui/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/ui"><img src="https://poser.pugx.org/laravel/ui/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/ui"><img src="https://poser.pugx.org/laravel/ui/license.svg" alt="License"></a>
<a href="https://packagist.org/packages/laravel/ui"><img src="https://img.shields.io/packagist/dt/laravel/ui" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/ui"><img src="https://img.shields.io/packagist/v/laravel/ui" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/ui"><img src="https://img.shields.io/packagist/l/laravel/ui" alt="License"></a>
## Introduction
### This project should no longer be used on new Laravel projects. Please use [Laravel Jetstream](https://github.com/laravel/jetstream) instead.
While Laravel does not dictate which JavaScript or CSS pre-processors you use, it does provide a basic starting point using [Bootstrap](https://getbootstrap.com/), [React](https://reactjs.org/), and / or [Vue](https://vuejs.org/) that will be helpful for many applications. By default, Laravel uses [NPM](https://www.npmjs.org/) to install both of these frontend packages.
**We are not accepting new presets.**
> This legacy package is a very simple authentication scaffolding built on the Bootstrap CSS framework. While it continues to work with the latest version of Laravel, you should consider using [Laravel Breeze](https://github.com/laravel/breeze) for new projects. Or, for something more robust, consider [Laravel Jetstream](https://github.com/laravel/jetstream).
## Official Documentation
Documentation can be found on the [Laravel website](https://laravel.com/docs/frontend).
### Supported Versions
Only the latest major version of Laravel UI receives bug fixes. The table below lists compatible Laravel versions:
| Version | Laravel Version |
|---- |----|
| [1.x](https://github.com/laravel/ui/tree/1.x) | 5.8, 6.x |
| [2.x](https://github.com/laravel/ui/tree/2.x) | 7.x |
| [3.x](https://github.com/laravel/ui/tree/3.x) | 8.x, 9.x |
### Installation
The Bootstrap and Vue scaffolding provided by Laravel is located in the `laravel/ui` Composer package, which may be installed using Composer:
```bash
composer require laravel/ui
```
Once the `laravel/ui` package has been installed, you may install the frontend scaffolding using the `ui` Artisan command:
```bash
// Generate basic scaffolding...
php artisan ui bootstrap
php artisan ui vue
php artisan ui react
// Generate login / registration scaffolding...
php artisan ui bootstrap --auth
php artisan ui vue --auth
php artisan ui react --auth
```
#### CSS
[Laravel Mix](https://laravel.com/docs/mix) provides a clean, expressive API over compiling SASS or Less, which are extensions of plain CSS that add variables, mixins, and other powerful features that make working with CSS much more enjoyable. In this document, we will briefly discuss CSS compilation in general; however, you should consult the full [Laravel Mix documentation](https://laravel.com/docs/mix) for more information on compiling SASS or Less.
#### JavaScript
Laravel does not require you to use a specific JavaScript framework or library to build your applications. In fact, you don't have to use JavaScript at all. However, Laravel does include some basic scaffolding to make it easier to get started writing modern JavaScript using the [Vue](https://vuejs.org) library. Vue provides an expressive API for building robust JavaScript applications using components. As with CSS, we may use Laravel Mix to easily compile JavaScript components into a single, browser-ready JavaScript file.
### Writing CSS
After installing the `laravel/ui` Composer package and [generating the frontend scaffolding](#introduction), Laravel's `package.json` file will include the `bootstrap` package to help you get started prototyping your application's frontend using Bootstrap. However, feel free to add or remove packages from the `package.json` file as needed for your own application. You are not required to use the Bootstrap framework to build your Laravel application - it is provided as a good starting point for those who choose to use it.
Before compiling your CSS, install your project's frontend dependencies using the [Node package manager (NPM)](https://www.npmjs.org):
```bash
npm install
```
Once the dependencies have been installed using `npm install`, you can compile your SASS files to plain CSS using [Laravel Mix](https://laravel.com/docs/mix#working-with-stylesheets). The `npm run dev` command will process the instructions in your `webpack.mix.js` file. Typically, your compiled CSS will be placed in the `public/css` directory:
```bash
npm run dev
```
The `webpack.mix.js` file included with Laravel's frontend scaffolding will compile the `resources/sass/app.scss` SASS file. This `app.scss` file imports a file of SASS variables and loads Bootstrap, which provides a good starting point for most applications. Feel free to customize the `app.scss` file however you wish or even use an entirely different pre-processor by [configuring Laravel Mix](https://laravel.com/docs/mix).
### Writing JavaScript
All of the JavaScript dependencies required by your application can be found in the `package.json` file in the project's root directory. This file is similar to a `composer.json` file except it specifies JavaScript dependencies instead of PHP dependencies. You can install these dependencies using the [Node package manager (NPM)](https://www.npmjs.org):
```bash
npm install
```
> By default, the Laravel `package.json` file includes a few packages such as `lodash` and `axios` to help you get started building your JavaScript application. Feel free to add or remove from the `package.json` file as needed for your own application.
Once the packages are installed, you can use the `npm run dev` command to [compile your assets](https://laravel.com/docs/mix). Webpack is a module bundler for modern JavaScript applications. When you run the `npm run dev` command, Webpack will execute the instructions in your `webpack.mix.js` file:
```bash
npm run dev
```
By default, the Laravel `webpack.mix.js` file compiles your SASS and the `resources/js/app.js` file. Within the `app.js` file you may register your Vue components or, if you prefer a different framework, configure your own JavaScript application. Your compiled JavaScript will typically be placed in the `public/js` directory.
> The `app.js` file will load the `resources/js/bootstrap.js` file which bootstraps and configures Vue, Axios, jQuery, and all other JavaScript dependencies. If you have additional JavaScript dependencies to configure, you may do so in this file.
#### Writing Vue Components
When using the `laravel/ui` package to scaffold your frontend, an `ExampleComponent.vue` Vue component will be placed in the `resources/js/components` directory. The `ExampleComponent.vue` file is an example of a [single file Vue component](https://vuejs.org/guide/single-file-components) which defines its JavaScript and HTML template in the same file. Single file components provide a very convenient approach to building JavaScript driven applications. The example component is registered in your `app.js` file:
```javascript
Vue.component(
'example-component',
require('./components/ExampleComponent.vue').default
);
```
To use the component in your application, you may drop it into one of your HTML templates. For example, after running the `php artisan ui vue --auth` Artisan command to scaffold your application's authentication and registration screens, you could drop the component into the `home.blade.php` Blade template:
```blade
@extends('layouts.app')
@section('content')
<example-component></example-component>
@endsection
```
> Remember, you should run the `npm run dev` command each time you change a Vue component. Or, you may run the `npm run watch` command to monitor and automatically recompile your components each time they are modified.
If you are interested in learning more about writing Vue components, you should read the [Vue documentation](https://vuejs.org/guide/), which provides a thorough, easy-to-read overview of the entire Vue framework.
#### Using React
If you prefer to use React to build your JavaScript application, Laravel makes it a cinch to swap the Vue scaffolding with React scaffolding:
```bash
composer require laravel/ui
// Generate basic scaffolding...
php artisan ui react
// Generate login / registration scaffolding...
php artisan ui react --auth
````
### Adding Presets
Presets are "macroable", which allows you to add additional methods to the `UiCommand` class at runtime. For example, the following code adds a `nextjs` method to the `UiCommand` class. Typically, you should declare preset macros in a [service provider](https://laravel.com/docs/providers):
```php
use Laravel\Ui\UiCommand;
UiCommand::macro('nextjs', function (UiCommand $command) {
// Scaffold your frontend...
});
```
Then, you may call the new preset via the `ui` command:
```bash
php artisan ui nextjs
```
## Contributing

View File

@@ -44,6 +44,10 @@ trait AuthenticatesUsers
}
if ($this->attemptLogin($request)) {
if ($request->hasSession()) {
$request->session()->put('auth.password_confirmed_at', time());
}
return $this->sendLoginResponse($request);
}
@@ -80,7 +84,7 @@ trait AuthenticatesUsers
protected function attemptLogin(Request $request)
{
return $this->guard()->attempt(
$this->credentials($request), $request->filled('remember')
$this->credentials($request), $request->boolean('remember')
);
}

View File

@@ -55,7 +55,7 @@ trait ConfirmsPasswords
protected function rules()
{
return [
'password' => 'required|password',
'password' => 'required|current_password:web',
];
}

View File

@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules;
use Illuminate\Validation\ValidationException;
trait ResetsPasswords
@@ -21,11 +22,12 @@ trait ResetsPasswords
* If no token is present, display the link request form.
*
* @param \Illuminate\Http\Request $request
* @param string|null $token
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function showResetForm(Request $request, $token = null)
public function showResetForm(Request $request)
{
$token = $request->route()->parameter('token');
return view('auth.passwords.reset')->with(
['token' => $token, 'email' => $request->email]
);
@@ -68,7 +70,7 @@ trait ResetsPasswords
return [
'token' => 'required',
'email' => 'required|email',
'password' => 'required|confirmed|min:8',
'password' => ['required', 'confirmed', Rules\Password::defaults()],
];
}

View File

@@ -6,7 +6,6 @@ use Illuminate\Auth\Events\Lockout;
use Illuminate\Cache\RateLimiter;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
@@ -42,7 +41,7 @@ trait ThrottlesLogins
* Redirect the user after determining they are locked out.
*
* @param \Illuminate\Http\Request $request
* @return void
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Illuminate\Validation\ValidationException
*/
@@ -53,7 +52,7 @@ trait ThrottlesLogins
);
throw ValidationException::withMessages([
$this->username() => [Lang::get('auth.throttle', [
$this->username() => [trans('auth.throttle', [
'seconds' => $seconds,
'minutes' => ceil($seconds / 60),
])],
@@ -90,7 +89,7 @@ trait ThrottlesLogins
*/
protected function throttleKey(Request $request)
{
return Str::lower($request->input($this->username())).'|'.$request->ip();
return Str::transliterate(Str::lower($request->input($this->username())).'|'.$request->ip());
}
/**

View File

@@ -10,10 +10,14 @@
}
],
"require": {
"php": "^7.2.5|^8.0",
"illuminate/console": "^7.0",
"illuminate/filesystem": "^7.0",
"illuminate/support": "^7.0"
"php": "^7.3|^8.0",
"illuminate/console": "^8.42|^9.0",
"illuminate/filesystem": "^8.42|^9.0",
"illuminate/support": "^8.82|^9.0",
"illuminate/validation": "^8.42|^9.0"
},
"require-dev": {
"orchestra/testbench": "^6.23|^7.0"
},
"autoload": {
"psr-4": {
@@ -25,6 +29,9 @@
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
},
"laravel": {
"providers": [
"Laravel\\Ui\\UiServiceProvider"

View File

@@ -11,8 +11,8 @@
<form method="POST" action="{{ route('login') }}">
@csrf
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@@ -25,8 +25,8 @@
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
@@ -39,7 +39,7 @@
</div>
</div>
<div class="form-group row">
<div class="row mb-3">
<div class="col-md-6 offset-md-4">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>
@@ -51,7 +51,7 @@
</div>
</div>
<div class="form-group row mb-0">
<div class="row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Login') }}

View File

@@ -13,8 +13,8 @@
<form method="POST" action="{{ route('password.confirm') }}">
@csrf
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
@@ -27,7 +27,7 @@
</div>
</div>
<div class="form-group row mb-0">
<div class="row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Confirm Password') }}

View File

@@ -17,8 +17,8 @@
<form method="POST" action="{{ route('password.email') }}">
@csrf
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@@ -31,7 +31,7 @@
</div>
</div>
<div class="form-group row mb-0">
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Send Password Reset Link') }}

View File

@@ -13,8 +13,8 @@
<input type="hidden" name="token" value="{{ $token }}">
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus>
@@ -27,8 +27,8 @@
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@@ -41,15 +41,15 @@
</div>
</div>
<div class="form-group row">
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">{{ __('Confirm Password') }}</label>
<div class="row mb-3">
<label for="password-confirm" class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
</div>
</div>
<div class="form-group row mb-0">
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Reset Password') }}

View File

@@ -11,8 +11,8 @@
<form method="POST" action="{{ route('register') }}">
@csrf
<div class="form-group row">
<label for="name" class="col-md-4 col-form-label text-md-right">{{ __('Name') }}</label>
<div class="row mb-3">
<label for="name" class="col-md-4 col-form-label text-md-end">{{ __('Name') }}</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
@@ -25,8 +25,8 @@
</div>
</div>
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="row mb-3">
<label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
@@ -39,8 +39,8 @@
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="row mb-3">
<label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@@ -53,15 +53,15 @@
</div>
</div>
<div class="form-group row">
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">{{ __('Confirm Password') }}</label>
<div class="row mb-3">
<label for="password-confirm" class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
</div>
</div>
<div class="form-group row mb-0">
<div class="row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Register') }}

View File

@@ -26,23 +26,26 @@
<a class="navbar-brand" href="{{ url('/') }}">
{{ config('app.name', 'Laravel') }}
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<!-- Left Side Of Navbar -->
<ul class="navbar-nav mr-auto">
<ul class="navbar-nav me-auto">
</ul>
<!-- Right Side Of Navbar -->
<ul class="navbar-nav ml-auto">
<ul class="navbar-nav ms-auto">
<!-- Authentication Links -->
@guest
<li class="nav-item">
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
</li>
@if (Route::has('login'))
<li class="nav-item">
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
</li>
@endif
@if (Route::has('register'))
<li class="nav-item">
<a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
@@ -50,11 +53,11 @@
@endif
@else
<li class="nav-item dropdown">
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
{{ Auth::user()->name }}
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">

View File

@@ -1,4 +1,4 @@
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

View File

@@ -13,45 +13,49 @@ class AuthRouteMethods
public function auth()
{
return function ($options = []) {
// Login Routes...
if ($options['login'] ?? true) {
$this->get('login', 'Auth\LoginController@showLoginForm')->name('login');
$this->post('login', 'Auth\LoginController@login');
}
// Logout Routes...
if ($options['logout'] ?? true) {
$this->post('logout', 'Auth\LoginController@logout')->name('logout');
}
$namespace = class_exists($this->prependGroupNamespace('Auth\LoginController')) ? null : 'App\Http\Controllers';
// Registration Routes...
if ($options['register'] ?? true) {
$this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
$this->post('register', 'Auth\RegisterController@register');
}
$this->group(['namespace' => $namespace], function() use($options) {
// Login Routes...
if ($options['login'] ?? true) {
$this->get('login', 'Auth\LoginController@showLoginForm')->name('login');
$this->post('login', 'Auth\LoginController@login');
}
// Password Reset Routes...
if ($options['reset'] ?? true) {
$this->resetPassword();
}
// Logout Routes...
if ($options['logout'] ?? true) {
$this->post('logout', 'Auth\LoginController@logout')->name('logout');
}
// Password Confirmation Routes...
if ($options['confirm'] ??
class_exists($this->prependGroupNamespace('Auth\ConfirmPasswordController'))) {
$this->confirmPassword();
}
// Registration Routes...
if ($options['register'] ?? true) {
$this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
$this->post('register', 'Auth\RegisterController@register');
}
// Email Verification Routes...
if ($options['verify'] ?? false) {
$this->emailVerification();
}
// Password Reset Routes...
if ($options['reset'] ?? true) {
$this->resetPassword();
}
// Password Confirmation Routes...
if ($options['confirm'] ??
class_exists($this->prependGroupNamespace('Auth\ConfirmPasswordController'))) {
$this->confirmPassword();
}
// Email Verification Routes...
if ($options['verify'] ?? false) {
$this->emailVerification();
}
});
};
}
/**
* Register the typical reset password routes for an application.
*
* @return void
* @return callable
*/
public function resetPassword()
{
@@ -66,7 +70,7 @@ class AuthRouteMethods
/**
* Register the typical confirm password routes for an application.
*
* @return void
* @return callable
*/
public function confirmPassword()
{
@@ -79,7 +83,7 @@ class AuthRouteMethods
/**
* Register the typical email verification routes for an application.
*
* @return void
* @return callable
*/
public function emailVerification()
{

View File

@@ -29,11 +29,10 @@ class Bootstrap extends Preset
protected static function updatePackageArray(array $packages)
{
return [
'bootstrap' => '^4.0.0',
'jquery' => '^3.2',
'popper.js' => '^1.12',
'sass' => '^1.15.2',
'sass-loader' => '^8.0.0',
'bootstrap' => '^5.1.3',
'@popperjs/core' => '^2.10.2',
'sass' => '^1.32.11',
'sass-loader' => '^11.0.1',
] + $packages;
}

View File

@@ -31,9 +31,9 @@ class React extends Preset
protected static function updatePackageArray(array $packages)
{
return [
'@babel/preset-react' => '^7.0.0',
'react' => '^16.2.0',
'react-dom' => '^16.2.0',
'@babel/preset-react' => '^7.13.13',
'react' => '^17.0.2',
'react-dom' => '^17.0.2',
] + Arr::except($packages, ['vue', 'vue-template-compiler']);
}

View File

@@ -31,11 +31,11 @@ class Vue extends Preset
protected static function updatePackageArray(array $packages)
{
return [
'resolve-url-loader' => '^2.3.1',
'sass' => '^1.20.1',
'sass-loader' => '^8.0.0',
'vue' => '^2.5.17',
'vue-template-compiler' => '^2.6.10',
'resolve-url-loader' => '^3.1.2',
'sass' => '^1.32.11',
'sass-loader' => '^11.0.1',
'vue' => '^2.6.12',
'vue-template-compiler' => '^2.6.12',
] + Arr::except($packages, [
'@babel/preset-react',
'react',

View File

@@ -5,15 +5,3 @@ $body-bg: #f8fafc;
$font-family-sans-serif: 'Nunito', sans-serif;
$font-size-base: 0.9rem;
$line-height-base: 1.6;
// Colors
$blue: #3490dc;
$indigo: #6574cd;
$purple: #9561e2;
$pink: #f66d9b;
$red: #e3342f;
$orange: #f6993f;
$yellow: #ffed4a;
$green: #38c172;
$teal: #4dc0b5;
$cyan: #6cb2eb;

View File

@@ -1,15 +1,6 @@
window._ = require('lodash');
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
*/
try {
window.Popper = require('popper.js').default;
window.$ = window.jQuery = require('jquery');
require('bootstrap');
} catch (e) {}

View File

@@ -12,4 +12,5 @@ const mix = require('laravel-mix');
*/
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');
.sass('resources/sass/app.scss', 'public/css')
.sourceMaps();

View File

@@ -11,5 +11,6 @@ const mix = require('laravel-mix');
|
*/
mix.react('resources/js/app.js', 'public/js')
mix.js('resources/js/app.js', 'public/js')
.react()
.sass('resources/sass/app.scss', 'public/css');

View File

@@ -6,7 +6,7 @@
require('./bootstrap');
window.Vue = require('vue');
window.Vue = require('vue').default;
/**
* The following block of code may be used to automatically register your

View File

@@ -12,4 +12,5 @@ const mix = require('laravel-mix');
*/
mix.js('resources/js/app.js', 'public/js')
.vue()
.sass('resources/sass/app.scss', 'public/css');

View File

@@ -4,7 +4,7 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use App\User;
use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
@@ -60,7 +60,7 @@ class RegisterController extends Controller
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
* @return \App\Models\User
*/
protected function create(array $data)
{

View File

@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
@@ -29,4 +29,4 @@ class CreatePasswordResetsTable extends Migration
{
Schema::dropIfExists('password_resets');
}
}
};

View File

@@ -0,0 +1,174 @@
<?php
namespace Laravel\Ui\Tests\AuthBackend;
use Illuminate\Auth\Events\Attempting;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Routing\Pipeline;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Event;
use Illuminate\Testing\TestResponse;
use Illuminate\Validation\ValidationException;
use Orchestra\Testbench\Factories\UserFactory;
use Orchestra\Testbench\TestCase;
class AuthenticatesUsersTest extends TestCase
{
use AuthenticatesUsers;
protected function tearDown(): void
{
Auth::logout();
parent::tearDown();
}
/**
* Define database migrations.
*
* @return void
*/
protected function defineDatabaseMigrations()
{
$this->loadLaravelMigrations();
}
/** @test */
public function it_can_authenticate_a_user()
{
Event::fake();
$user = UserFactory::new()->create();
$request = Request::create('/login', 'POST', [
'email' => $user->email,
'password' => 'password',
], [], [], [
'HTTP_ACCEPT' => 'application/json',
]);
$response = $this->handleRequestUsing($request, function ($request) {
return $this->login($request);
})->assertStatus(204);
Event::assertDispatched(function (Attempting $event) {
return $event->remember === false;
});
}
/** @test */
public function it_can_authenticate_a_user_with_remember_as_false()
{
Event::fake();
$user = UserFactory::new()->create();
$request = Request::create('/login', 'POST', [
'email' => $user->email,
'password' => 'password',
'remember' => false,
], [], [], [
'HTTP_ACCEPT' => 'application/json',
]);
$response = $this->handleRequestUsing($request, function ($request) {
return $this->login($request);
})->assertStatus(204);
Event::assertDispatched(function (Attempting $event) {
return $event->remember === false;
});
}
/** @test */
public function it_can_authenticate_a_user_with_remember_as_true()
{
Event::fake();
$user = UserFactory::new()->create();
$request = Request::create('/login', 'POST', [
'email' => $user->email,
'password' => 'password',
'remember' => true,
], [], [], [
'HTTP_ACCEPT' => 'application/json',
]);
$response = $this->handleRequestUsing($request, function ($request) {
return $this->login($request);
})->assertStatus(204);
Event::assertDispatched(function (Attempting $event) {
return $event->remember === true;
});
}
/** @test */
public function it_cant_authenticate_a_user_with_invalid_password()
{
$user = UserFactory::new()->create();
$request = Request::create('/login', 'POST', [
'email' => $user->email,
'password' => 'invalid-password',
], [], [], [
'HTTP_ACCEPT' => 'application/json',
]);
$response = $this->handleRequestUsing($request, function ($request) {
return $this->login($request);
})->assertUnprocessable();
$this->assertInstanceOf(ValidationException::class, $response->exception);
$this->assertSame([
'email' => [
'These credentials do not match our records.',
],
], $response->exception->errors());
}
/** @test */
public function it_cant_authenticate_unknown_credential()
{
$request = Request::create('/login', 'POST', [
'email' => 'taylor@laravel.com',
'password' => 'password',
], [], [], [
'HTTP_ACCEPT' => 'application/json',
]);
$response = $this->handleRequestUsing($request, function ($request) {
return $this->login($request);
})->assertUnprocessable();
$this->assertInstanceOf(ValidationException::class, $response->exception);
$this->assertSame([
'email' => [
'These credentials do not match our records.',
],
], $response->exception->errors());
}
/**
* Handle Request using the following pipeline.
*
* @param \Illuminate\Http\Request $request
* @param callable $callback
* @return \Illuminate\Testing\TestResponse
*/
protected function handleRequestUsing(Request $request, callable $callback)
{
return new TestResponse(
(new Pipeline($this->app))
->send($request)
->through([
\Illuminate\Session\Middleware\StartSession::class,
])
->then($callback)
);
}
}

View File

@@ -0,0 +1,105 @@
<?php
namespace Laravel\Ui\Tests\AuthBackend;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Foundation\Auth\User;
use Illuminate\Http\Request;
use Illuminate\Routing\Pipeline;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Testing\TestResponse;
use Illuminate\Validation\ValidationException;
use Orchestra\Testbench\Factories\UserFactory;
use Orchestra\Testbench\TestCase;
class RegistersUsersTest extends TestCase
{
use RegistersUsers;
/**
* Define database migrations.
*
* @return void
*/
protected function defineDatabaseMigrations()
{
$this->loadLaravelMigrations();
}
/** @test */
public function it_can_register_a_user()
{
$request = Request::create('/register', 'POST', [
'name' => 'Taylor Otwell',
'email' => 'taylor@laravel.com',
'password' => 'secret-password',
'password_confirmation' => 'secret-password',
], [], [], [
'HTTP_ACCEPT' => 'application/json',
]);
$response = $this->handleRequestUsing($request, function ($request) {
return $this->register($request);
})->assertCreated();
$this->assertDatabaseHas('users', [
'name' => 'Taylor Otwell',
'email' => 'taylor@laravel.com',
]);
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\Models\User
*/
protected function create(array $data)
{
$user = (new User())->forceFill([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
$user->save();
return $user;
}
/**
* Handle Request using the following pipeline.
*
* @param \Illuminate\Http\Request $request
* @param callable $callback
* @return \Illuminate\Testing\TestResponse
*/
protected function handleRequestUsing(Request $request, callable $callback)
{
return new TestResponse(
(new Pipeline($this->app))
->send($request)
->through([
\Illuminate\Session\Middleware\StartSession::class,
])
->then($callback)
);
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Laravel\Ui\Tests\AuthBackend;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Orchestra\Testbench\TestCase;
use Illuminate\Http\Request;
use PHPUnit\Framework\MockObject\MockObject;
class ThrottleLoginsTest extends TestCase
{
/**
* @test
* @dataProvider emailProvider
*/
public function it_can_generate_throttle_key(string $email, string $expectedEmail): void
{
$throttle = $this->getMockForTrait(ThrottlesLogins::class, [], '', true, true, true, ['username']);
$throttle->method('username')->willReturn('email');
$reflection = new \ReflectionClass($throttle);
$method = $reflection->getMethod('throttleKey');
$method->setAccessible(true);
$request = $this->mock(Request::class);
$request->expects('input')->with('email')->andReturn($email);
$request->expects('ip')->andReturn('192.168.0.1');
$this->assertSame($expectedEmail . '|192.168.0.1', $method->invoke($throttle, $request));
}
public function emailProvider(): array
{
return [
'lowercase special characters' => ['ⓣⓔⓢⓣ@ⓛⓐⓡⓐⓥⓔⓛ.ⓒⓞⓜ', 'test@laravel.com'],
'uppercase special characters' => ['ⓉⒺⓈⓉ@ⓁⒶⓇⒶⓋⒺⓁ.ⒸⓄⓂ', 'test@laravel.com'],
'special character numbers' =>['test⑩⓸③@laravel.com', 'test1043@laravel.com'],
'default email' => ['test@laravel.com', 'test@laravel.com'],
];
}
}