Nadir,
If you own the services that are being displayed in the viewer the easiest way to add a login screen is to secure your services in arcgis server manager:
once you have secured a service the viewer will automatically show a login window
regards
anthony