Can the bank change the locks and lock me out after a foreclosure?
After a property goes to foreclosure, the bank/investor will have a representative contact you. During this occupancy check, their first objective is to find out if you are a renter or the prior owner. They will also want to know if you intend to move or if they can negotiate a move-out date. If you are not home, they will leave a note with a contact number. It is in your best interest to call them or they could assume that the property has been abandoned.
If you are living in the property, they cannot just change the locks and lock you out of the property, instead they must first give you notice (in California renters without a long term lease get 90-days notice while owners get 3 days notice), then file an unlawful detainer lawsuit (eviction), and finally get a judgment ordering the eviction. The eviction process typically takes 30-90 days in California. Most banks/investors will offer you cash-4-keys paying you to leave the property quickly and clean.
If they believe the property is vacant or abandoned, they can enter and change the locks. If you come home to find the locks changed and you are still living in the property, contact them (they typically leave a note on the door or window with a contact number) and if you can prove that you still live there, they should turn over a new key.