I'll here assume there is only one network path active, with either an all-wired network or one Wi-Fi device in use (but not both), and that all computers here are configured in the same IP subnet, and that you're on a private network using NAT and a private IP address block.
Are you running OS X Server and Server.app here? Because if you're not (and you're seeing some comment about a server password in some error message or dialog box), then the password involved is either your shortname or your full name as the username on the iMac, and whatever password is used to log into the iMac directly. (I'd expect OS X Server to be running local DNS, and the .local domain isn't something that would be expected with typical OS X Server DNS configuration.)
On the iMac, launch Console.app from Applications > Utilities folder, and then try the login from the MacBook Pro, and see if there are any relevant error messages logged on the iMac. (If you should decide to post Console log output here, please do not post more than one block of any repeating messages, please don't post more than maybe a hundred lines max, and please check for sensitive or confidential data before posting it.)
Some folks have used odd-ball software widgets and text completion tools and other such, and some of those sometimes either supply a password or alter a supplied password. If you have any of those, please disable those and try again. If you have any anti-virus, anti-malware, system optimizers or accelerators, performance-enhancements, or cache cleaners or other such add-on tools, please disable all of those per the vendor-specific sequences, and then repeat your tests.