Skip to content
This repository has been archived by the owner on May 28, 2023. It is now read-only.

add validation for user profile update, add getToken #488

Merged
merged 6 commits into from
Jul 16, 2020
Merged

add validation for user profile update, add getToken #488

merged 6 commits into from
Jul 16, 2020

Conversation

gibkigonzo
Copy link
Collaborator

  • Added validation for user profile update.
  • add getToken to handle getting token from header

@gibkigonzo gibkigonzo requested a review from pkarw July 16, 2020 13:51
@gibkigonzo gibkigonzo merged commit aead6d8 into vuestorefront:develop Jul 16, 2020
@gibkigonzo gibkigonzo mentioned this pull request Jul 20, 2020
@netzkollektiv
Copy link

@gibkigonzo
This validation makes it really hard to customize the user profile update form. If you remove a field, the validation in the api needs to be updated. How is it intended to do this? Is there any reason why this needs to be validated in vsf-api additionally?

Thanks!

@gibkigonzo
Copy link
Collaborator Author

You can use src/models/userProfileUpdate.schema.extension.json to customize validation. Logic that I've added only checks if update action came from valid user. Magento allows to modify user address by using id of different user. So we needed to add this validation https://github.com/vuestorefront/vue-storefront-api/pull/488/files#diff-f70a8489a60f3ab71b81acf5b38e95c81b2355b960608e008156bf77e3ca4a13R29 to make it more secure

@netzkollektiv
Copy link

Thanks! That's a good thing! However, is it intended to change the core (src/models/userProfileUpdate.schema.extension.json) for custom functionality? Shouldn't there be a hook or something like that?

@gibkigonzo
Copy link
Collaborator Author

It is intended. This file will not be changed so you shouldnt be afraid of conflicts.

I agree that hooks will be better, but as I know vsf1 is now LTS and vsf-api is part of it. So I'm not sure if there will be such a change. You can also ask on discord channel :) gl

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants