previous two password functionality