Comment to 'Password encryption on UNA '
  • Hello Alchemy!

    Well, your task is almost clear except question where data about this site will arrive from. If you know how to fill and process it with the then it's OK. More critical part is changing core files like inc/profile.inc.php. It's not good especially in UNA which has many tools to call own code without changes system files which can be changed during the next upgrade :-)

    So let's do it prolerly right from now. UNA has alert system almost like in Dolphin, but more advanced. So it is needed to fire some alert(event) in one place and caught it with a handler somewhere else. You may meet in code constructions like (for example in function bx_login, file inc/profiles.inc.php)

    bx_alert('account', 'login', $iId);

    It means that system call all alert handlers for system type "account" and action "login". $iId is object identifier, in this case - id of logged account.

    So now you may to create own handler to add some own action after login where possible to process data from login form on your own look.

    Necessary stages for this:

    1) create some PHP file like BxDolAdvancedLogin.php in inc/classes/ folder (if you don't want to create own module for now)

    2) in this file create code like

    class BxDolAdvancedLogin extends BxBaseModProfileAlertsResponse
    {
    public function __construct()
    {
    $this->MODULE = 'bx_persons';
    parent::__construct();
    }

    public function response($oAlert)
    {
    parent::response($oAlert);

    switch ($oAlert->action)

    {

    case 'login':

    // make actions with login form data wcich you need

    break;

    }

    }
    }

    3) Run this queries in your UNA Database:

    INSERT INTO `sys_alerts_handlers` (`name`, `class`, `file`, `service_call`) VALUES
    ('adv_login', 'BxDolAdvancedLogin ', 'inc/classes/BxDolAdvancedLogin.php', '');
    SET @iHandler := LAST_INSERT_ID();

    INSERT INTO `sys_alerts` (`unit`, `action`, `handler_id`) VALUES
    ('acount', 'login', @iHandler);

    4) go to Studio and clear caches.

    So after this actions after every login in your UNA site you will have call of your code in mentioned PHP file.

    If this way is little hard for now and you're sute that you will remember your changes in system files then add this code

    // make actions with login form data wcich you need

    in function bx_login right after the following line:

    bx_alert('account', 'login', $iId);

    With the best regards, Leonid