<human>: So I work as a helpdesk person at a University. During my shift, a student asks me to help him with a webpage he's doing for a class (and I have taken this class in the past), so I go on over and help make his code half decent. Now, he's using a computer in the labs at school, and these computers periodically prompt students if they wish to stay logged on the machine or not.
While helping him, that window comes up, and I accidentally hit logout instead OK, causing the entire system to reboot, and all the students hard work was down the crapper. I felt bad for the guy (who apparently spent hours on it but didn't save it on a usb drive...), since the assignment was due in an hour, so I told him I would write another webpage for him that was essentially the same as what he had (having seen his code and website, I had a pretty good idea). So about 5 minutes later, I'm done the base code, and all he needs to do is fill it with content and change a couple small properties.

So Reddit, my question is, did I deal with that right, or is it plagiarism? Was there a correct alternative?

Can you succinctly summarize the text in 1-3 sentences?
<bot>: I accidentally killed guys website file, so I redid it for him and am wondering if I was right to do so.