Forget your password? Don't worry, you can still use the original invitation password that was sent to you when your account was created!

Curious to try out another's account? Don't worry, you can use the original invitation password to log in as anyone!

CREATE PROCEDURE [spAUTH] 
@EMAIL VARCHAR(100),
@PSWD VARCHAR(20)
AS

SELECT  USER_ID, 
        FIRST_NAME + ' ' + LAST_NAME AS FULL_NAME,
        EMAIL,
        PSWD
FROM    USER
WHERE   (IS_ACTIVE = 1) 
        AND (IS_DELETED = 0)
        AND (EMAIL = @EMAIL) 
        AND (PSWD = @PSWD)
UNION
SELECT  USER_ID, 
        FIRST_NAME + ' ' + LAST_NAME AS FULL_NAME,
        EMAIL,
        PSWD
FROM    USER
WHERE   (IS_ACTIVE = 1) 
        AND (IS_DELETED = 0)
        AND (EMAIL = @EMAIL) 
        AND (DBO.GET_INVITATION_PWD() = @PSWD)

"After recovering from the initial shock of reading through the code," Ben adds, "I verified that DBO.GET_INVITATION_PWD() had not been updated since it was created over two years ago."