Near expiry password feature

Near expiry password feature
refactored the code.