Authentication via PIN

From #3265 and #3293.