Any city or town may by ordinance of its legislative authority determine whether there shall be any residential qualifications for any or all of its appointive officials or for preference in employment of its employees, but residence of an employee outside the limits of such city or town shall not be grounds for discharge of any regularly appointed civil service employee otherwise qualified: PROVIDED, That this section shall not authorize a city or town to change any residential qualifications prescribed in any city charter for any appointive official or employee: PROVIDED, FURTHER, That all employees appointed prior to the enactment of any ordinance establishing such residence qualifications as provided herein or who shall have been appointed or employed by such cities or towns having waived such residential requirements shall not be discharged by reason of such appointive officials or employees having established their residence outside the limits of such city or town: PROVIDED, FURTHER, That this section shall not authorize a city or town to change the residential requirements with respect to employees of private public utilities acquired by public utility districts or by the city or town.