The foreclosure theorhetically cuts off your rights under the lease. There are several caeveat here. Your lease is good until title transfers. To evict you they will have to go to Court after that which will take 2-3 months. I would guess you have about a year before anything will happen. You may be able cut a deal with the bank.
As a general rule, the lease is subordinate to the mortgage - meaning that the mortgage holder has greater rights than a tenant.
As a practical matter, that means that the bank - after it becomes the owner at the conclusion of the foreclosure process - will have the right to move to evict you. However, the bank may have an interest in having a paying tenant at the property who is maintaining it. So, at some point, it might make sense to try to contact the bank to see if they want you to remain. I agree with the other attorney, that nothing is likely to happen in the next twelve months.
This answer is for general education purposes only. It neither creates an attorney-client relationship nor provides legal guidance or advice. The answer is based on the limited information provided and the answer might be different had additional information been provided. You should consult an attorney.