Skip to content

Commit

Permalink
fix url handling
Browse files Browse the repository at this point in the history
  • Loading branch information
HichemTab-tech committed May 12, 2023
1 parent 9c64f5c commit b2e34ef
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 160 deletions.
9 changes: 9 additions & 0 deletions .idea/codeception.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 33 additions & 18 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/phpspec.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/phpunit.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 47 additions & 1 deletion .idea/tokens-validation.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"illuminate/database": "^9.52",
"illuminate/events": "^9.52",
"illuminate/container": "^9.52",
"jwage/purl": "^0.0.9",
"defuse/php-encryption": "^2.3",
"illuminate/http": "^9.52"
},
Expand Down
109 changes: 1 addition & 108 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 10 additions & 18 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@
TokensValidation::setFeatures([
'AuthTokens',
'ConfirmationToken',
'InvitationsTokens'
]);

TokensValidation::setInvitationTokenExpirationDelay(60*60*24);
TokensValidation::$InvitationBaseUrl = "http://localhost/invitations";
TokensValidation::$InvitationTokenGenerator = MyInvitationTokenGenerator::class;
TokensValidation::$InvitationUrlBuilder = MyInvitationUrlBuilder::class;
/*TokensValidation::$InvitationTokenGenerator = MyInvitationTokenGenerator::class;
TokensValidation::$InvitationUrlBuilder = MyInvitationUrlBuilder::class;*/

TokensValidation::prepare();

echo "<pre>";
/*print_r(TokensValidation::$config);
/*echo "<pre>";
print_r(TokensValidation::$config);
die();*/
/*try {
$inv = TokensValidation::createInvitation(
Expand All @@ -37,10 +36,9 @@
$inv->getUrl(),
$inv
]);*/

try {
/*try {
$inv = TokensValidation::checkInvitationUrl(
url: "http://localhost/invitations?c=TQrI32ZN7f7gKF7yPtmT8mQLp",
url: "http://localhost/invitations?c=e6dXr7kg5aPO4Olz5RlpXHiww",
whatFor: "administration",
);
Expand All @@ -51,30 +49,24 @@
}
print_r([
$inv
]);
]);*/

//verify the data entered by the user.


$invitation = TokensValidation::checkInvitationToken(
/*$invitation = TokensValidation::checkInvitationToken(
token: $_GET['token'],
whatFor: "administration",
thenAccept: true
);
if (!$invitation->isValidationSucceed()) {
die("INVITATION_INVALID");
}
}*/

//insert the data entered by the user.
//performe some actions
echo "invitation accepted";

?>
die();

<form method="post" action="">
<input type="text" name="fname">
<input type="text" name="lname">
<input type="email" name="email" readonly value="<?php echo $invitation->getTargetEmail() ?>">
<button>submit</button>
</form>
Loading

0 comments on commit b2e34ef

Please sign in to comment.