1
- # Authentication Laravel package
1
+ # Auth
2
2
3
- Laravel AWES.IO Auth package with ability to use standard authentication flow as well as socialite and two factor authentication.
3
+ Laravel Auth package with buit-in two-factor (Authy) and social authentication (Socialite) .
4
4
5
5
## Installation
6
6
@@ -12,44 +12,39 @@ $ composer require awes-io/auth
12
12
13
13
The package will automatically register itself.
14
14
15
- You can publish migrations with :
15
+ You can publish migrations:
16
16
17
17
``` bash
18
18
php artisan vendor:publish --provider=" AwesIO\Auth\AuthServiceProvider" --tag=" migrations"
19
19
```
20
20
21
- After migrations have been published you can create required tables by running:
21
+ After migrations have been published you can create required db tables by running:
22
22
23
23
``` bash
24
24
php artisan migrate
25
25
```
26
26
27
- And seed countries table :
27
+ Publish views :
28
28
29
29
``` bash
30
- php artisan db:seed --class =" AwesIO\Auth\Seeds\CountryTableSeeder "
30
+ php artisan vendor:publish --provider =" AwesIO\Auth\AuthServiceProvider " --tag= " views "
31
31
```
32
32
33
- You can publish config file with:
34
-
35
- ``` bash
36
- php artisan vendor:publish --provider=" AwesIO\Auth\AuthServiceProvider" --tag=" config"
37
- ```
33
+ ## Configuration
38
34
39
- You can publish views with :
35
+ Publish config file :
40
36
41
37
``` bash
42
- php artisan vendor:publish --provider=" AwesIO\Auth\AuthServiceProvider" --tag=" views "
38
+ php artisan vendor:publish --provider=" AwesIO\Auth\AuthServiceProvider" --tag=" config "
43
39
```
44
40
45
- ## Configuration
46
-
47
- You can disable some of package's additional features:
41
+ You can disable additional features by commenting them out:
48
42
49
43
``` php
50
44
'enabled' => [
51
45
'social',
52
46
// 'two_factor',
47
+ // 'email_verification',
53
48
],
54
49
```
55
50
@@ -68,7 +63,7 @@ Add new socialite services:
68
63
],
69
64
```
70
65
71
- Configure redirects on package's routes :
66
+ And configure redirect paths :
72
67
73
68
``` php
74
69
'redirects' => [
@@ -78,6 +73,8 @@ Configure redirects on package's routes:
78
73
],
79
74
```
80
75
76
+ ### Social and two-factor authentication
77
+
81
78
Several .env variables required if additional modules were enabled in config:
82
79
83
80
``` php
@@ -86,7 +83,7 @@ GITHUB_CLIENT_ID=
86
83
GITHUB_CLIENT_SECRET=
87
84
GITHUB_REDIRECT_URL=http://auth.test/login/github/callback
88
85
89
- # 2FA AUTHY
86
+ # TWO FACTOR AUTHY
90
87
AUTHY_SECRET=
91
88
```
92
89
@@ -102,29 +99,20 @@ class User extends Authenticatable
102
99
}
103
100
```
104
101
105
- ### Email verification
102
+ ### Email verification & resetting passwords
106
103
107
- To use email verification functionality, add SendsEmailVerification trait :
104
+ To use email verification functionality and to reset passwords , add ` SendsEmailVerification ` and ` SendsPasswordReset ` traits :
108
105
109
106
``` php
107
+ use AwesIO\Auth\Models\Traits\SendsPasswordReset;
110
108
use AwesIO\Auth\Models\Traits\SendsEmailVerification;
111
109
112
110
class User extends Authenticatable
113
111
{
114
- use SendsEmailVerification;
112
+ use SendsEmailVerification, SendsPasswordReset ;
115
113
}
116
114
```
117
115
118
- and make sure to enable it in awesio-auth.php config file:
119
-
120
- ``` php
121
- 'enabled' => [
122
- ...
123
- 'email_verification',
124
- ...
125
- ],
126
- ```
127
-
128
116
## Usage
129
117
130
118
Add to routes/web.php:
@@ -133,13 +121,19 @@ Add to routes/web.php:
133
121
AwesAuth::routes();
134
122
```
135
123
136
- By default package will register several routes:
124
+ You can disable registration:
125
+
126
+ ``` php
127
+ AwesAuth::routes(['register' => false]);
128
+ ```
129
+
130
+ Package will register several routes:
137
131
138
132
```
139
133
+--------+----------------------------------------+--------------------------+--------------------------+----------------------------------------------------------------------+--------------------------------------------------------+
140
134
| Domain | Method | URI | Name | Action | Middleware |
141
135
+--------+----------------------------------------+--------------------------+--------------------------+----------------------------------------------------------------------+--------------------------------------------------------+
142
- | | GET|HEAD | email/resend | verification.resend | AwesIO\Auth\Controllers\VerificationController@resend | web,auth,throttle:6,1 |
136
+ | | GET|HEAD | email/resend | verification.resend | AwesIO\Auth\Controllers\VerificationController@resend | web,throttle:1,0.2, auth,throttle:6,1 |
143
137
| | POST | email/verify | verification.code.verify | AwesIO\Auth\Controllers\VerificationController@verifyCode | web,auth |
144
138
| | GET|HEAD | email/verify | verification.code | AwesIO\Auth\Controllers\VerificationController@show | web,auth |
145
139
| | GET|HEAD | email/verify/{id} | verification.verify | AwesIO\Auth\Controllers\VerificationController@verify | web,auth,signed,throttle:6,1 |
@@ -163,17 +157,17 @@ By default package will register several routes:
163
157
+--------+----------------------------------------+--------------------------+--------------------------+----------------------------------------------------------------------+--------------------------------------------------------+
164
158
```
165
159
166
- Besides standard authentication laravel routes, package will add:
160
+ Besides default authentication routes, it will add:
167
161
168
162
``` php
169
163
# Socialite routes
170
164
'login.social'
171
165
'login/{service}/callback'
172
166
173
- # 2FA setup and routes for enabling/disabling it
167
+ # Two factor authentication setup routes
174
168
'twofactor.index', 'twofactor.store', 'twofactor.destroy', 'twofactor.verify'
175
169
176
- # 2FA login routes
170
+ # Two factor authentication login routes
177
171
'login.twofactor.index', 'login.twofactor.verify'
178
172
179
173
# Email verification routes
0 commit comments