Skip to content

Commit 52d89d0

Browse files
Merge branch 'dev' into 'master'
Dev See merge request awes/wiki!12
2 parents 2b0dccc + d846c4d commit 52d89d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+4300
-54
lines changed

docs/components/auth/1.1/index.md

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Authentication Laravel package
1+
# Auth
22

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).
44

55
## Installation
66

@@ -12,44 +12,39 @@ $ composer require awes-io/auth
1212

1313
The package will automatically register itself.
1414

15-
You can publish migrations with:
15+
You can publish migrations:
1616

1717
```bash
1818
php artisan vendor:publish --provider="AwesIO\Auth\AuthServiceProvider" --tag="migrations"
1919
```
2020

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:
2222

2323
```bash
2424
php artisan migrate
2525
```
2626

27-
And seed countries table:
27+
Publish views:
2828

2929
```bash
30-
php artisan db:seed --class="AwesIO\Auth\Seeds\CountryTableSeeder"
30+
php artisan vendor:publish --provider="AwesIO\Auth\AuthServiceProvider" --tag="views"
3131
```
3232

33-
You can publish config file with:
34-
35-
```bash
36-
php artisan vendor:publish --provider="AwesIO\Auth\AuthServiceProvider" --tag="config"
37-
```
33+
## Configuration
3834

39-
You can publish views with:
35+
Publish config file:
4036

4137
```bash
42-
php artisan vendor:publish --provider="AwesIO\Auth\AuthServiceProvider" --tag="views"
38+
php artisan vendor:publish --provider="AwesIO\Auth\AuthServiceProvider" --tag="config"
4339
```
4440

45-
## Configuration
46-
47-
You can disable some of package's additional features:
41+
You can disable additional features by commenting them out:
4842

4943
```php
5044
'enabled' => [
5145
'social',
5246
// 'two_factor',
47+
// 'email_verification',
5348
],
5449
```
5550

@@ -68,7 +63,7 @@ Add new socialite services:
6863
],
6964
```
7065

71-
Configure redirects on package's routes:
66+
And configure redirect paths:
7267

7368
```php
7469
'redirects' => [
@@ -78,6 +73,8 @@ Configure redirects on package's routes:
7873
],
7974
```
8075

76+
### Social and two-factor authentication
77+
8178
Several .env variables required if additional modules were enabled in config:
8279

8380
```php
@@ -86,7 +83,7 @@ GITHUB_CLIENT_ID=
8683
GITHUB_CLIENT_SECRET=
8784
GITHUB_REDIRECT_URL=http://auth.test/login/github/callback
8885

89-
# 2FA AUTHY
86+
# TWO FACTOR AUTHY
9087
AUTHY_SECRET=
9188
```
9289

@@ -102,29 +99,20 @@ class User extends Authenticatable
10299
}
103100
```
104101

105-
### Email verification
102+
### Email verification & resetting passwords
106103

107-
To use email verification functionality, add SendsEmailVerification trait:
104+
To use email verification functionality and to reset passwords, add `SendsEmailVerification` and `SendsPasswordReset` traits:
108105

109106
```php
107+
use AwesIO\Auth\Models\Traits\SendsPasswordReset;
110108
use AwesIO\Auth\Models\Traits\SendsEmailVerification;
111109

112110
class User extends Authenticatable
113111
{
114-
use SendsEmailVerification;
112+
use SendsEmailVerification, SendsPasswordReset;
115113
}
116114
```
117115

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-
128116
## Usage
129117

130118
Add to routes/web.php:
@@ -133,13 +121,19 @@ Add to routes/web.php:
133121
AwesAuth::routes();
134122
```
135123

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:
137131

138132
```
139133
+--------+----------------------------------------+--------------------------+--------------------------+----------------------------------------------------------------------+--------------------------------------------------------+
140134
| Domain | Method | URI | Name | Action | Middleware |
141135
+--------+----------------------------------------+--------------------------+--------------------------+----------------------------------------------------------------------+--------------------------------------------------------+
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 |
143137
| | POST | email/verify | verification.code.verify | AwesIO\Auth\Controllers\VerificationController@verifyCode | web,auth |
144138
| | GET|HEAD | email/verify | verification.code | AwesIO\Auth\Controllers\VerificationController@show | web,auth |
145139
| | 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:
163157
+--------+----------------------------------------+--------------------------+--------------------------+----------------------------------------------------------------------+--------------------------------------------------------+
164158
```
165159

166-
Besides standard authentication laravel routes, package will add:
160+
Besides default authentication routes, it will add:
167161

168162
```php
169163
# Socialite routes
170164
'login.social'
171165
'login/{service}/callback'
172166

173-
# 2FA setup and routes for enabling/disabling it
167+
# Two factor authentication setup routes
174168
'twofactor.index', 'twofactor.store', 'twofactor.destroy', 'twofactor.verify'
175169

176-
# 2FA login routes
170+
# Two factor authentication login routes
177171
'login.twofactor.index', 'login.twofactor.verify'
178172

179173
# Email verification routes
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# The <fb-auto-captcha> Component
2+
3+
The Recaptcha component. It can be located only within the <form-builder> component with non-editable name of `g-recaptcha-response` and uses the [vue-recaptcha](https://github.com/DanSnow/vue-recaptcha) component.
4+
5+
By default, the field is hidden if the `show`property is not passed. If the server response contains an error for the field with component identifier, the field will be displayed (that is, the recaptcha will appear). In the visual presentation below, you can watch this component in action.
6+
7+
![fb-auto-captcha](https://static.awes.io/docs/fb-auto-captcha.gif)
8+
9+
## Components
10+
* [Form Builder](./form-builder.md)
11+
* **Auto Captcha**
12+
* [Checkbox](./fb-checkbox.md)
13+
* [Code](./fb-code.md)
14+
* [Company Slug](./fb-company-slug.md)
15+
* [Date](./fb-date.md)
16+
* [Date range](./fb-date-range.md)
17+
* [Editor](./fb-editor.md)
18+
* [Input](./fb-input.md)
19+
* [Multi block](./fb-multi-block.md)
20+
* [Phone](./fb-phone.md)
21+
* [Radio Group](./fb-radio-group.md)
22+
* [Select](./fb-select.md)
23+
* [Slider](./fb-slider.md)
24+
* [Switcher](./fb-switcher.md)
25+
* [Textarea](./fb-textarea.md)
26+
* [Uploader](./fb-uploader.md)
27+
28+
## Example
29+
30+
```html
31+
<form-builder url="/api-url">
32+
<fb-auto-captcha :show="true"></fb-auto-captcha>
33+
</form-builder>
34+
```
35+
36+
<form-builder url="/api-url">
37+
<fb-auto-captcha :show="true"></fb-auto-captcha>
38+
</form-builder>
39+
40+
41+
## Component properties
42+
43+
| Name | Type | Default | Description |
44+
|---------------------|:------------------:|:-------------------:|---------------------------------------------------|
45+
| **id** | `Number` | `undefined` | Sequence number within the &lt;fb-multi-block&gt; component |
46+
| **show** | `Boolean` | `false` | Show recaptcha |
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# The &lt;fb-checkbox&gt; Component
2+
3+
It can be located within the &lt;form-builder&gt; component, then it looks for the value, by the path given in the `name` property, or sets one if nothing found with a value of `value` property. Outside form component it can be used with a `v-model` directive
4+
5+
![fb-checkbox](https://static.awes.io/docs/fb-checkbox.png)
6+
7+
## Components
8+
* [Form Builder](./form-builder.md)
9+
* [Auto Captcha](./fb-auto-captcha.md)
10+
* **Checkbox**
11+
* [Code](./fb-code.md)
12+
* [Company Slug](./fb-company-slug.md)
13+
* [Date](./fb-date.md)
14+
* [Date range](./fb-date-range.md)
15+
* [Editor](./fb-editor.md)
16+
* [Input](./fb-input.md)
17+
* [Multi block](./fb-multi-block.md)
18+
* [Phone](./fb-phone.md)
19+
* [Radio Group](./fb-radio-group.md)
20+
* [Select](./fb-select.md)
21+
* [Slider](./fb-slider.md)
22+
* [Switcher](./fb-switcher.md)
23+
* [Textarea](./fb-textarea.md)
24+
* [Uploader](./fb-uploader.md)
25+
26+
## Example
27+
28+
```html
29+
<form-builder url="/api-url">
30+
<fb-checkbox name="agree" label="Agree with cookie policy"></fb-checkbox>
31+
</form-builder>
32+
```
33+
<div class="vue-example">
34+
<form-builder url="/api-url">
35+
<fb-checkbox name="agree" label="Agree with cookie policy"></fb-checkbox>
36+
</form-builder>
37+
</div>
38+
39+
40+
## Component properties
41+
42+
| Name | Type | Default | Description |
43+
|---------------------|:------------------:|:-------------------:|---------------------------------------------------|
44+
| **name** | `String` | `undefined` | Field identifier in the data object |
45+
| **value** | `Boolean, Number, Array` | `0` | Used internally for Vue `v-model` directive |
46+
| **default-value** | `String` | value of label prop | An HTML `value` attribute of checkbox (for multiple chechboxes, used in `v-model`) |
47+
| **id** | `Number` | `undefined` | Sequence number within the &lt;fb-multi-block&gt; component |
48+
| **label** | `String` | `''` | Text in the &lt;label&gt; element |
49+
| **enter-skip** | `Boolean` | `false` | Skip field when switching by the <kbd>enter</kbd> button |
50+
| **focus** | `Boolean` | `false` | Set focus on this field when loading a page |
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# The &lt;fb-code&gt; Component
2+
3+
It is a component of the field for entering code. It can be located only within the &lt;form-builder&gt; component.
4+
5+
> Note! **auto-submit** property is removed use the same property on the &lt;form-builder&gt; itself
6+
7+
Here is a visual presentation of this component.
8+
9+
![fb-code](https://storage.googleapis.com/static.awes.io/docs/fb-code.gif)
10+
11+
## Components
12+
* [Form Builder](./form-builder.md)
13+
* [Auto Captcha](./fb-auto-captcha.md)
14+
* [Checkbox](./fb-checkbox.md)
15+
* **Code**
16+
* [Company Slug](./fb-company-slug.md)
17+
* [Date](./fb-date.md)
18+
* [Date range](./fb-date-range.md)
19+
* [Editor](./fb-editor.md)
20+
* [Input](./fb-input.md)
21+
* [Multi block](./fb-multi-block.md)
22+
* [Phone](./fb-phone.md)
23+
* [Radio Group](./fb-radio-group.md)
24+
* [Select](./fb-select.md)
25+
* [Slider](./fb-slider.md)
26+
* [Switcher](./fb-switcher.md)
27+
* [Textarea](./fb-textarea.md)
28+
* [Uploader](./fb-uploader.md)
29+
30+
## Example
31+
32+
```html
33+
<form-builder url="/api-url">
34+
<fb-code name="code"></fb-code>
35+
</form-builder>
36+
```
37+
38+
@vue
39+
<form-builder url="/api-url">
40+
<fb-code name="code"></fb-code>
41+
</form-builder>
42+
@endvue
43+
44+
45+
## Component properties
46+
47+
| Name | Type | Default | Description |
48+
|---------------------|:------------------:|:-------------------:|---------------------------------------------------|
49+
| **name(*)** | `String` | `undefined` | Field identifier in the data object |
50+
| **id** | `Number` | `undefined` | Sequence number within the &lt;fb-multi-block&gt; component |
51+
| **length** | `Number` | `6` | Number of digits in the code |
52+
| **enter-skip** | `Boolean` | `false` | Skip field when switching by the <kbd>enter</kbd> button |
53+
| **focus** | `Boolean` | `false` | Set focus on this field when loading a page |

0 commit comments

Comments
 (0)