iMac not logging probably due to keychains problem
You need to boot your Mac into Recovery HD mode, and then use the Reset Password utility utility to reset your log-in password.

Shut down your Mac, and press the power button. As soon as you heard the start-up chime, hold down the Option key. Images of more than one boot volume will show up. Use the arrow keys to select Recovery HD. When bootup in Recovery HD completes, you can find the Reset Password utility in the menu commands. Sorry, I don't have a screen shot.