Function for assigning a temporary password