Modal dialogs should be used with care and should be avoided when possible. The StackExchange login is a great example on how to do it right.
There are some legitimate reasons for using modal dialogs. When there is a positive user action (print for instance - show print options). But login could be done in another way.
If it's your choice, choose something else. If it's someone else's choice, try to convince him/her there are other options. Look at useit.com for more info (I have nothing to do with them).
Modal Dialog Boxes: Yes or No?
When it comes to modal dialog boxes, our winners have very distinct ideologies. At one extreme is Seating Management. As a real-time application monitoring a physical environment, Seating Management didn't set out to interrupt hostess work in any way. If a hostess wants to seat 5 guests at a table that the database says has a capacity of 4, the system won't halt the running of the restaurant by saying that it can't be done. Maybe that party looked friendly enough that they can squeeze in an extra chair.
At the other extreme, several apps use modal dialog boxes — and plenty of them — in ways that clearly stop users in their tracks and require them to do something before they can proceed. As discussed below, the lightbox was a preferred technique to this end.
So, what's the answer here? There is none. Generally, a user experience feels more accommodating if modal dialog boxes are avoided or downplayed. But, when something does need fixing, it's better to make sure that the user knows about it.