Search code examples
authenticationpasswordsexpressionengine

EE2 - bypass a login with a unique URL?


I have a weird problem - I'm working on a portfolio site built in Expression Engine that has a number of clients who all obviously need to log in to access their portfolio.

I've been asked to see if there's a way that a user could login once, and then somehow, from then on, be able to bypass the login screen when they return to the site - the main client is keen on a unique URL, and I can't see how this would be done. I'm a bit of a novice with Expression Engine, so if anyone has any tips I'd love to hear them!

Cheers in advance.


Solution

  • You would need to build an add-on with a module and extension to do this. Many steps involved, but doable.

    • create a new table to hold some sort of unique ID, a member_id, and probably an expiry date
    • insert a new action when your module is installed, and have a corresponding method which will handle logins in your module
    • use the member_member_login_start extension hook to insert a new row into this table, and then to generate an email which is sent to the member's email address which contains an action URL built using the unique value you just inserted (e.g., http:/mysite.com/?ACT=XX&unique_id=XXXXXX)

    Something like that.