Jump to content

Recommended Posts

Posted

Hey,

I am using the following script for API logins

 

        if (isset(\IPS\Request::i()->email) and isset(\IPS\Request::i()->password)) {
            $login = new \IPS\Login();
            $loginHandler = \IPS\Login\Handler::findMethod('IPS\Login\Handler\Standard');
            $email = \IPS\Request::i()->email;
            try {
                $member = $loginHandler->authenticateUsernamePassword($login, $email, \IPS\Request::i()->protect('password'));
                if (28 === $member->member_group_id) {
                    echo json_encode(array(
                        "STATUS" => "BANNED",
                        "MEMBER_ID" => $member->member_id
                    ));
                    die;
                }
                echo json_encode(array(
                    "STATUS" => "VALID",
                    "MEMBER_ID" => $member->member_id
                ));
            } catch (\IPS\Login\Exception $ex) {
                if ($ex->getMessage() == 'login_err_bad_password') {
                    echo json_encode(array("STATUS" => "INVALID_PASSWORD"));
                } else {
                    echo json_encode(array("STATUS" => "INVALID_EMAIL"));
                }
            }
        }

This was working fine for invalid passwords previously, but now the exception chucks out numbers/letters like so

8415284d58274fdc9d0900706cd58f46

Meaning it'd never match 'login_err_bad_password' as it previously did?

Really stuck on this and would appreicate some help if anyone could provide!

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...