Extract out reset password method.