Cal. Civ. Proc. Code § 1161b
(b) In addition to the rights set forth in subdivision (a), tenants or subtenants holding possession of a rental housing unit under a fixed-term residential lease entered into before transfer of title at the foreclosure sale shall have the right to possession until the end of the lease term, and all rights and obligations under the lease shall survive foreclosure, except that the tenancy may be terminated upon 90 days’ written notice to quit pursuant to subdivision (a) if any of the following conditions apply: