Login Tag

The {exp:missing_link:cp_login} tag redirects users to a control panel login page and returns them to the frontend of the site immediately after they login. This simplifies the login workflow and avoids users having to login both on the front and back end.

Simply add the tag to an empty template. If a user accesses this template while logged in they will be immediately redirected to the return page that you have specified.

Should you wish to access the control panel ‘traditionally’ the normal control panel login procedure is not affected by this tag.

It’s not a good idea to publish your control panel login URL and the same applies here, particularly if you aren’t using EE’s masked CP access.


Parameters

return

The page users should return to after logging in. This should be in the form of EE segments, for example:

{exp:missing_link:cp_login return="news/archives"

If the return parameter is omitted users will be redirected to the previous page.


An Alternative Approach

Another option is to use ExpressionEngine’s native frontend login form which enables you to create a login form that’s styled to match your site. This works very well, however it can result in users having to login twice, depending on your site’s session preferences. This happens because EE distinguishes between frontend sessions and control panel sessions.

You can view your session preferences by going to Admin → Security & Privacy → Security & Session Preferences. If you set both the User and Control Panel session type to ‘cookies only’ then the frontend login form will also log users into the control panel. If you would prefer to use more secure session preferences for your control panel then the cp_login tag is recommended.