Working password reset

@prashtx Probably needs lots of cleanup, but can you take a quick look over it?