There has been a federal law in place that gives rental victims of foreclosure a window of time and/or an upholding of their lease if the property gets foreclosed upon.
California just passed a couple of bills that will extend the following until 2019:
Under the bills, new owners of a rental property, who bought the home in foreclosure, must give tenants 90 days notice before starting an eviction and must honor any fixed-term leases entered into before the sale.
It's important to remember that you still have to pay your rental amount. The terms of the lease may not be honored if you are not keeping up your end of the contract.