Submit a MR, Review your diffs and fixup!!, then slack the MR url
Flashcards Webapp Assignment
Address all feedback from prior MRâs on both sides, and merge.
Create a new branch.
Implement the âSignupâ feature. This will be very similar to the âLoginâ
feature from last week, with minor variations. Use your work from last week as
a pattern for working through this feature.
Youâll need to POST to the /signup route instead of /login, but the
shape of the JSON you send and receive is both exactly the same.
Youâll need to make another thunk, which should end up being nearly
identical to the the login thunk
Once youâve got both thunks hooked up and working, DRY up your code by
extracting a helper function that will do all the work that is the same
between the two thunks, and take an argument to handle the small difference
between the two thunks. Each thunk should call out to this helper function.
Commit your work.
Next, implement the âremember me for two weeksâ feature (if you havenât
already done so).
If it is checked when the user logs in, an expiration date should be set
when calling setUserToken().
Probably you donât need new Redux state for this temporary piece of info, it
should be enough to pass a boolean to the login() thunk, and use that to
set the expiration when storing the token in localStorage.
So, youâll need a piece of local state (using useState() to track this
variable within the component) and then when the âsubmitâ button is clicked,
youâll pass along this info to the thunk. That means the login() thunk
will need to be modified to accept an argument.
Commit your work.
Finally, if you havenât already done it, add links to/from the login and
signup routes, each linking to the other, so that if someone already has an
account they can navigate from the /signup screen easily to /login, and vice
versa.
Do it, starting with the shell of main provided in recover.c
Hints:
filter.c from last week is really useful, refer to it for opening files,
reading/writing files, pulling bytes out of a file with fread, etc.
use the Harvard man pages, especially for functions like fopen, fread,
and sprintf.
This can be done with or without malloc. Neither way is substantially
easier or harder, I would prefer you use malloc.
youâll need to think through how youâre going to manage memory.
I would strongly recommend sketching out helper functions you with George
would write for you.
Write psuedo code for yourself in comments detailing how to tackle the
problem little by little, then try to slowly implement it.
a small preparatory task to help you get rolling would be to see if you
could check every âblockâ of memory, and test each one to see if it started
a jpeg, and count the jpegs you find. You should get 50. If you can do that,
you will have written a bunch of useful code that will help you with the
rest of the process.
Read all of the hints I wrote for the âMore comfortableâ homework
After youâve cloned and opened the repo, type git fetch and then
git co -b recover-<yourname> origin/less-comfortable to switch to a branch
that has more code roughed in to help you accomplish the task.
Slowly and carefully read the comments I wrote up to line 100.
Then, jump down into the main function and complete steps 1 and 2, as
written up in comments.
Complete the rest of the steps.
I do have a video for you to lean on, but I only want you to use the video
after you have really given it a good try without. And every spot in the video
where I say to stop the video, I want you to do so and try to continue on your
own without it, returning to the video only if and when you need idt, and when
youâve worked hard to try to solve it on your own for a while.