When you are logged out from AEN http://<your-aen-url> , you will be redirected to http://<your-repo-url>/account/login?next=http://<your-aen-url>/ and you will see the following page displaying "Could not log you in".
After entering the login credentials, you can acess Repository but not AEN.
It is caused by Anaconda Repository's safe url code that only allows the next value to be a relative path for the current domain and will not allow the login to redirect back to AEN when the AEN domain is different from Repository.
Upgrade your Repository to version 2.33.17 or above which has a fix for this issue.
Repository versions 2.33.17 and above has whitelist feature added through the NEXT_URL_WHITELIST and NEXT_URL_WHITELIST_REGEXP config settings that would allow clients to mark external hostnames as safe.