Jhbate/pw recovery

@kentquirk if you could have a look at this please.