sinara贾泊尔1998 / identifier
v1.6.4
2022-02-12 10:47 UTC
Requires
- php: 7.1.*|7.2.*|7.3.*|7.4.*|8.*
- laravel/framework: 7.*|8.*
- sinarajabpour1998/alpha-helper: 1.*
- sinarajabpour1998/log-manager: 1.*
- sinarajabpour1998/notifier: 2.*
README
Laravel Identifier 包 :: 简单认证(登录、注册和忘记密码)。
如何安装和配置sinarajabpour1998/identifier包?
⬇️ 安装
composer require sinarajabpour1998/identifier
发布配置文件
php artisan vendor:publish --tag=identifier
- 更新(注意!会覆盖现有设置)
php artisan vendor:publish --tag=identifier --force
迁移表,向数据库添加标识符表
php artisan migrate
📖 如何更改认证选项
- 在/config/identifier.php中设置配置
用法
- 创建resources/sass/auth.scss文件并添加以下代码
// Fonts @import './fonts/awesome/awesome-font.css'; @import './fonts/iransans/iransans-font.css'; @import "./vendor/identifier/identifier.scss";
- 请注意,字体目录取决于您的项目结构。请使用自己的目录替换它们。
- 创建resources/js/auth.js文件并添加以下代码
require('./bootstrap'); require("./vendor/identifier/identifier");
- 直接在webpack.mix.js中添加创建的文件
.js('resources/js/auth.js', 'public/js') .sass('resources/sass/auth.scss', 'public/css')
- 运行npm
npm run dev
- 使用此路由将用户重定向到登录和注册页面
route('identifier.login');
- 更改
app/Http/Middleware/Authenticate.php如下
protected function redirectTo($request) { if (! $request->expectsJson()) { return route('identifier.login'); } }
- 清除缓存
php artisan cache:clear php artisan view:clear php artisan route:clear php artisan config:clear
- 完成!
###功能
- 动态网站名称和术语URL(通过配置文件更改)
- 配置
return[ // other codes ... // the title of site (this will be used in title and help titles) 'site_title' => env('APP_NAME', 'پیش فرض'), // full url of terms page (this will be used in register page) 'terms_url' => 'https://test.com/', // other codes ... ];
- 登录后分别针对管理员和用户动态重定向URL(通过配置文件更改)
- 配置
return[ // other codes ... // admin login redirect route name 'admin_login_redirect' => 'admin', // user login redirect route name 'user_login_redirect' => 'home', // other codes ... ];
- 动态CSS和JS路径
- 配置:您可以在发布的Sass和JS文件中更改任何内容,并将它们移动到所需位置,然后可以在配置文件中更改文件的位置
return[ // other codes ... // where did you required the identifier.scss file ? // this file must be included in webpack.js as well 'css_public_path' => 'css/auth.css', // where did you required the identifier.js file ? // this file must be included in webpack.js as well 'js_public_path' => 'js/auth.js', // other codes ... ];
- OTP代码长度
- 配置
return[ // other codes ... // OTP codes digit, by default it's 6-digit (secure and standard) 'otp_digit' => 6, // other codes ... ];
- 登录、注册或账户恢复后通过URL将用户重定向到特定位置(自1.3版本发布以来的新功能)
- 用法
https://example.com/auth/default?back=https://example.com/cart/confirm
###要求
- PHP v7.0或更高版本
- Laravel v7.0或更高版本
- sinarajabpour1998/notifier包 Packagist链接
- sinarajabpour1998/alpha-helper包 Packagist链接