in Education by
I'm building a single page application. On the client side I'm using Nuxt.js (which includes Vue.js and Vuex). To send and receive data to the server I use axios. The API was built with the Django REST framework. I have the following scenario: If a user wants to register, he starts on Page 1. Here he has the possibility to upload a profile picture. As soon as he has selected the picture it will be uploaded automatically into an S3 bucket. During or after the upload he can fill in the other fields First Name and Last Name. All these fields are temporarily saved in the Vuex store which means if the user reload the page the data is gone. If he clicks on Next Page he will be taken to another page (another URL; no page reload -> Single Page Application) where he can enter the remaining data. After clicking on the button Create Account the entry is created in the database. Now to my question... How should I handle the image upload? As already said, the picture should be uploaded directly after the selection and not only when you click on the button Create Account. At some point I have to create a relationship between the image and the account. So far I have come up with the following solution. The following ER model represents my database tables. If the user selects an image on Page 1, it's immediately uploaded into the S3 bucket and an entry in the Image table will be created. The API returns the ID of this image entry. I save this ID in the temporary Vuex Store so I can use it on Page 2 to send it to the API Endpoint which is responsible for the account creation. The problem is, the Vuex Store is not "secure", as an experienced user could easily edit the values via the console. So he could change the id of the image entry to an entry he didn't created at all. Does anyone know how to solve something like this or generally if this approach is common to handle image uploads before creating the account? (I've already seen this situation on many pages but I don't know how they solved this) JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
The best way would be adding another unique field and using something like uuid and use it instead of id, at least for registration or anywhere that accepting ids is not secure enough. Or a temporary slug or anything than can't be accessed publicly or guessed easily. Also you can filter out images that has no owner and accept these ids which is not as secure but the chance of someone getting another id that has no owner at that same exact time is pretty low. (OFC if you clear the images with no owner regularly) Also you should be concerned about the fact that users might stop at page 2 and you will have images with no owner (Extra space). If you have the relation in Image table then you can add a task to run each 24 hours and remove the images that has no owner or like X minutes passed from their creation or etc. Basically anytime you have to separate your single forms to separate steps, you'll end up adding some functions to do the cleaning.

Related questions

0 votes
    Currently I'm using Cloudinary.com to save my users images. I know how to do some of the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    Which one of the following statements is false? a) You need to create an account before you can send an e ... password with others. Select the correct answer from above options...
asked Nov 13, 2021 in Education by JackTerrance
0 votes
    I am using Laravel Image Intervention to resize an image upload field on my form. This is the error ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    I've followed all guides and answers, and everything displays correctly, but the actual upload doesn't ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 7, 2022 in Education by JackTerrance
0 votes
    I've followed all guides and answers, and everything displays correctly, but the actual upload doesn't ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    in my app i want to upload an image chosen via UIImagePickerController to a database which only accepts JPEG ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 16, 2022 in Education by JackTerrance
0 votes
    I writing a function in my form that require user to upload a file, but doesn't necessary have to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    Testing before deployment is not an essential step to ensure database security. (1)False (2)True...
asked May 18, 2021 in Technology by JackTerrance
0 votes
    Can image be used as a hyperlink while creating html document? If yes, write the syntax. Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    The account used to make the database connection must have______ privilege. (1)Admin (2)Least (3)Highest...
asked May 13, 2021 in Technology by JackTerrance
0 votes
    Question Can I build a image database/library that has an e-commerce style checkout system and a powerful ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Question Can I build a image database/library that has an e-commerce style checkout system and a powerful ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Question Can I build a image database/library that has an e-commerce style checkout system and a powerful ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    On Internet Explorer, the standard HTML file upload form also allows for direct input of the file name ( ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 10, 2022 in Education by JackTerrance
0 votes
    Before starting to enter data in a table, you must create the: a. Design of the table c. Database from which to ... d. All of these Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
...