Hi,
there is a standard user exit SUSR0001 that gets called after user logs on with SAP gui. You could use it to implement this logic. It only works for sap gui. It does not work on web based apps such as web dynpro. Also users must not have access to debugger.
Cheers