Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

[Solved] Trying to customize login function - can't find the right one

jspautschjspautsch ✭✭✭
edited September 2011 in Vanilla 2.0 - 2.8
Hello everyone,

What I ultimately want is to integrate a vanilla 2 forum with our SSO service (Atlassian Crowd). I've tried ProxyConnect but due to reasons that are too complex to get into right now I don't think it's going to work, so I've been looking into other options.

What I'm trying to do is simply "intercept" whatever function is being called when a user logs in and put in some of my own code, code I already know works and that will communicate with the SSO service and authenticate the user credentials before continuing with the login (it will also call InsertForBasic() if the user doesn't exist already).

However, I can't seem to find the function being called when a user logs in. With authentication set to Password in dashboard, I figured it would be Gdn_PasswordAuthenticator::Authenticate(), but that doesn't seem to be the case (changing the code, even deleting the code, doesn't seem to affect the login process). Can anyone help me find the right function?

Thanks!

Answers

  • Found it! Modifying the SignIn function in the EntryController class did the trick (applications/dashboard/controllers/class.entrycontroller.php).
  • Is it possible to isolate it in a plugin? It will save you a TON of headaches when it's time to upgrade.
  • That's next on my to-do list, but I'm new to this whole thing so I'm not quite sure how to do that yet.

    Unfortunately, this particular forum has a ton of unique requirements, which have forced me to make a ton of custom changes to a wide variety of models, views, etc. I really have no idea how to sum all of them up in a plugin.
  • @jspautch just remember to save your entire site before you do anything, like upgrading. Upgrading the files might have to be a manual job this time, but we can give you pointers for that.
    If you want to document all the changes for yourself, just give us a shout and we'll post some tips in this thread for you.

    There was an error rendering this rich post.

  • So far I've just been keeping track of the changes I've been making, the most significant next to adding in my SSO code is modifying GetByEmail() and ValidateUniqueFields() to ignore email (our SSO allows duplicate email, usernames are unique).

    I've been looking at the documentation to create plugins and it seems straightforward, but I was wondering, can magic methods be used to override existing core functions like GetByEmail() and ValidateUniqueFields()? If so I could just specify the modified versions in my plugin (updating them for new versions of Vanilla of course) and avoid having to fiddle with the core code.
  • Go figure, I just found a config option for turning off unique emails. :(

    $Configuration['Garden']['Registration']['EmailUnique'] = FALSE;
Sign In or Register to comment.