Not legal advice, but I think the rule is that if your landlord sells, then the buyer has to assume the lease, (as long as they have notice). Check your lease, it may have an exception.
If the bank repossesses and forces a sale, I think the new buyer may be able to evict you after giving you notice to quit. See California Civil Code 1161a.
Right now you have significant leverage to negotiate. You might want to ask for assurances.