Fix invalid return, put secret creation into funcion

refs #16269