That's what it does already. A user tries to log in, if they get the credentials wrong or the user is disabled, or they have no account, they can't log in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.