Skip to content

Commit 6fc4fcf

Browse files
add console feature, now the user can generate the classes to override defaults in TokensValidation using the commande artisan.
1 parent 5a67b32 commit 6fc4fcf

20 files changed

+683
-18
lines changed

.idea/codeception.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/php.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/phpspec.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/phpunit.xml

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/tokens-validation.iml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The TokensValidation library can be installed via Composer by running the follow
1818

1919
## Features
2020

21-
- Authenticate the user after the browser closed without password
21+
- Authenticate the user after the browser closed without a password
2222
- Generate custom confirmation codes with expiration delay.
2323
- Create invitation tokens to do some actions.
2424
- Flexibility of usage
@@ -90,7 +90,7 @@ $result = TokensValidation::checkAuthToken();
9090

9191
**TokensValidation::checkAuthToken()** checks the authentication token in the cookie and returns the result. If the validation is successful, a new token is generated and replaced in the cookie.
9292

93-
##### check the token without regenerate a new one:
93+
##### check the token without regenerating a new one:
9494

9595
```PHP
9696
$result = TokensValidation::checkAuthTokenWithoutRegenerate();
@@ -122,7 +122,7 @@ To check the authentication token, call the following method and pass the token
122122
```PHP
123123
$result = TokensValidation::checkAuthToken(authToken: $authToken);
124124
if ($result->isValidationSucceed()) {
125-
// log in the user automatically
125+
// log in the user automatically,
126126
//for example :
127127
echo $result->getUserId();
128128
echo $result->getNewToken()->getContent();// save it in cookies or whatever you want
@@ -182,7 +182,7 @@ To check the authentication token with a fingerprint, call the **checkAuthToken(
182182
$result = TokensValidation::checkAuthToken(authToken: $authToken, fingerPrint: $somefingerprint);
183183
```
184184

185-
- *to generate the fingerprint you can use for example https://github.com/Valve/fingerprintjs2*
185+
- *to generate the fingerprint, you can use for example https://github.com/Valve/fingerprintjs2*
186186

187187

188188

@@ -463,7 +463,7 @@ The **thenAccept** parameter in the method is utilized to mark the invitation as
463463
## In Laravel
464464

465465
You can use a configuration file named config/tokensvalidation.php to configure your library with its parameters.
466-
here's an example of tokensvalidation.php:
466+
Here's an example of tokensvalidation.php:
467467

468468
```PHP
469469
// you can customize the Classes here
@@ -515,10 +515,20 @@ To prepare or publish your files to a Laravel project, you need to run the follo
515515
php artisan vendor:publish --provider="HichemtabTech\TokensValidation\Laravel\Providers\TokensValidationProvider"
516516
```
517517

518+
In Laravel project you can generate class to override the default classes of TokensValidation
519+
(ConfirmationUrlBuilder, AuthTokenCookiesHandler...) by running the following command:
520+
521+
```bash
522+
php artisan tokensvalidation:handler
523+
```
524+
525+
after that, choose what class you want to generate and follow the instruction shown in the console.
518526

519527
### Errors identification
520528

521-
To identify and troubleshoot errors that may occur, you can utilize the **$result->getCause()** function, which returns a reference code to indicate the specific cause of the error. Several possible error codes may be returned by this function.
529+
To identify and troubleshoot errors that may occur, you can utilize the **$result->getCause()** function,
530+
which returns a reference code to indicate the specific cause of the error.
531+
This function may return several possible error codes.
522532
## Error Reference
523533

524534
| Error | Cause |

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"illuminate/events": "^9.52",
2121
"illuminate/container": "^9.52",
2222
"defuse/php-encryption": "^2.3",
23-
"illuminate/http": "^9.52"
23+
"illuminate/http": "^9.52",
24+
"illuminate/console": "9.52"
2425
},
2526
"extra": {
2627
"laravel": {

0 commit comments

Comments
 (0)