Intrinsic parameters of GRB 990123 from its prompt optical flash and afterglow