public function setToken($sIdentifier)
    {
        if (empty($sIdentifier)) {

            return false;
        }

        // --------------------------------------------------------------------------

        //  Generate code
        $sKey = sha1(sha1($this->salt()) . $this->salt() . APP_PRIVATE_KEY);
        $iTtl = time() + 86400; // 24 hours.

        // --------------------------------------------------------------------------

        //  Update the user
        $oUserModel = Factory::model('User', 'nails/module-auth');
        $oUser      = $oUserModel->getByIdentifier($sIdentifier);

        if ($oUser) {

            $aData = [
                'forgotten_password_code' => $iTtl . ':' . $sKey,
            ];

            return $oUserModel->update($oUser->id, $aData);

        } else {

            return false;
        }
    }
public function setToken($sIdentifier)
    {
        if (empty($sIdentifier)) {

            return false;
        }

        // --------------------------------------------------------------------------

        //  Generate code
        $sKey = sha1(sha1($this->salt()) . $this->salt() . APP_PRIVATE_KEY);
        $iTtl = time() + 86400; // 24 hours.

        // --------------------------------------------------------------------------

        //  Update the user
        $oUserModel = Factory::model('User', 'nails/module-auth');
        $oUser      = $oUserModel->getByIdentifier($sIdentifier);

        if ($oUser) {

            $aData = [
                'forgotten_password_code' => $iTtl . ':' . $sKey,
            ];

            return $oUserModel->update($oUser->id, $aData);

        } else {

            return false;
        }
    }
public function setToken ( $ sIdentifier ) { if ( empty ( $ sIdentifier ) ) { return false ; } // -------------------------------------------------------------------------- //  Generate code $ sKey = sha1 ( sha1 ( $ this -> salt ( ) ) . $ this -> salt ( ) . APP_PRIVATE_KEY ) ; $ iTtl = time ( ) + 86400 ; // 24 hours. // -------------------------------------------------------------------------- //  Update the user $ oUserModel = Factory :: model ( 'User' , 'nails/module-auth' ) ; $ oUser = $ oUserModel -> getByIdentifier ( $ sIdentifier ) ; if ( $ oUser ) { $ aData = [ 'forgotten_password_code' => $ iTtl . ':' . $ sKey , ] ; return $ oUserModel -> update ( $ oUser -> id , $ aData ) ; } else { return false ; } }
Sets a forgotten password token for a user

@param string $sIdentifier The identifier to use for setting the token (set by APP_NATIVE_LOGIN_USING)

@return boolean
Sets a forgotten password token for a user