Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
/*
Program Name: usp_passwdtest.sql
Programmer: William Fleming
Date Created: 9 June 2004
Last Updated: 17 June 2004
Purpose: To test validation of passwords
Dependancies: None.
*/
CREATE PROCEDURE usp_passwdtest
@old VARCHAR(100),
@new VARCHAR(100)
AS
--check that new and old passwords are different
IF @new = @old
BEGIN
RAISERROR ('New password must not be the same
as the old password.', 16,1)
RETURN (1)
END
--check that the length of the new password is 8 chars or more
ELSE
IF LEN(@new) < 8
BEGIN
RAISERROR ('New password must be eight characters or longer.',16,1)
RETURN (1)
END
--check that the password uses at least one number
ELSE
IF @new NOT LIKE '%[0-9]%'
BEGIN
RAISERROR ('New password must use at least one number.',16,1)
RETURN (1)
END
--check that the password uses at least one letter
ELSE
IF @new NOT LIKE '%[a-z]%'
BEGIN
RAISERROR ('New password must use at least one letter.',16,1)
RETURN (1)
END
--check that the password uses at least special character
ELSE
IF @new NOT LIKE '%[!@#$%^&*()]%'
BEGIN
RAISERROR ('New password must use at least one special character.',16,1)
RETURN (1)
END
--if the password passes validation, accept it
ELSE
PRINT 'Password acceptable'