Skip to content

Commit

Permalink
feat: UserValidationRequest configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Jun 14, 2022
1 parent 09a670f commit 400466e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,6 @@ CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
###< nelmio/cors-bundle ###

USER_PASSWORD_RESET_URL=https://roadiz-core-app.test/front/user/reset
USER_VALIDATION_URL=https://roadiz-core-app.test/front/user/validate
USER_PASSWORD_RESET_EXPIRES_IN=600
USER_VALIDATION_EXPIRES_IN=3600
17 changes: 16 additions & 1 deletion config/api_resources/user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RZ\Roadiz\CoreBundle\Entity\User:
path: '/users/signup'
controller: RZ\Roadiz\UserBundle\Controller\SignupController
input: RZ\Roadiz\UserBundle\Api\Dto\UserInput
output: RZ\Roadiz\UserBundle\Api\Dto\UserOutput
output: RZ\Roadiz\UserBundle\Api\Dto\VoidOutput
openapi_context:
summary: Create a new public user
parameters: ~
Expand All @@ -22,12 +22,27 @@ RZ\Roadiz\CoreBundle\Entity\User:
input: RZ\Roadiz\UserBundle\Api\Dto\UserPasswordRequestInput
output: RZ\Roadiz\UserBundle\Api\Dto\VoidOutput
# Password request must not call WriteListener to let PasswordRequestController persist changes.
write: false
validate: false
openapi_context:
summary: Request a public user new password
description: |
Initiate a public user new password request (forgot my password)
validation_request:
method: 'POST'
path: '/users/validation_request'
controller: RZ\Roadiz\UserBundle\Controller\ValidationRequestController
input: RZ\Roadiz\UserBundle\Api\Dto\UserValidationRequestInput
output: RZ\Roadiz\UserBundle\Api\Dto\VoidOutput
# Validation request must not call WriteListener to let ValidationRequestController persist changes.
write: false
validate: false
openapi_context:
summary: Request a public user email validation token
description: |
Initiate a public user validation request (to verify user email address)
itemOperations:
information:
method: 'GET'
Expand Down
15 changes: 15 additions & 0 deletions config/packages/roadiz_user.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
---
parameters:
env(USER_PASSWORD_RESET_URL): 'loginResetPage'
env(USER_VALIDATION_URL): 'loginResetPage'
env(USER_PASSWORD_RESET_EXPIRES_IN): '600'
env(USER_VALIDATION_EXPIRES_IN): '3600'

# Default configuration for "RoadizUserBundle"
roadiz_user:
# Define frontend URL to redirect user to after receiving its password recovery email.
# **This parameter supports Symfony routes name as well as hard-coded URLs.**
password_reset_url: '%env(string:USER_PASSWORD_RESET_URL)%'
# Define frontend URL to redirect user to after receiving its email validation request.
# **This parameter supports Symfony routes name as well as hard-coded URLs.**
user_validation_url: '%env(string:USER_VALIDATION_URL)%'
# Define password recovery expiring time in seconds.
password_reset_expires_in: '%env(int:USER_PASSWORD_RESET_EXPIRES_IN)%'
# Define user validation token expiring time in seconds.
user_validation_expires_in: '%env(int:USER_VALIDATION_EXPIRES_IN)%'
public_user_role_name: ROLE_PUBLIC_USER
email_validated_role_name: ROLE_EMAIL_VALIDATED

0 comments on commit 400466e

Please sign in to comment.