Smart card based password authentication is one of the efficient and simplest mechanisms to communicate over an insecure channel. Recently, Om et al. have proposed a 3-D geometric triangle based two way authentication scheme, which is an improved version of the Wu et al.'s straight line based remote login authentication. In this paper, we provide the cryptanalysis of the Om et al.'s two-way authentication scheme. To enhance the security, we propose a polygon based generalized scheme by considering all the flaws in the previous scheme. Furthermore, our scheme provides forgot password facility to users where they can reconnect with the server. The security analysis of our proposed scheme is explained in detail.