Search code examples
phpcodeigniter-2facebook-logincodeigniter-a3m

A3M auth for an already existing site


I am currently using tank auth in my project for authentication. Now I have decided to move into A3M as it also provides social integration. I am now stuck as no helper file is available for A3M integration to an existing site.

Please let me know if anyone is aware of the steps to be followed.


Solution

  • I've just pulled A3M into a site I'm working on. It was pretty straight forward as @Jakub says. For anyone else who hits this page, here are the steps I went through:

    1. Copy files from app/libraries; app/helpers; app/languages

      • Study files in app/controllers; and app/views, to see how to use the A3M system
        • The controllers can stay as is, you need to customize the views: sign_in, sign_up, sign_out, and account/*
    2. Copy:

      app/config/account
      app/helpers/*
      app/libraries/*
      app/models/account/
      app/controllers/account/
      app/views/account/
      app/views/sign*.php
      (if using the A3M Views) app/language/* (ie language/english/account/ 
          and general_lang.php)
      
    3. Configure app/config/account/* for your setup

    4. Check the "Session Variables" in app/config/config.php
    5. Add autoloads to app/config/autoload.php

      • $autoload['packages'] = array(APPPATH.'third_party');
      • $autoload['language'] = array('general');
      • // also suggest adding these if you check login status across your site:
      • $autoload['libraries'] = array('account/authentication', 'account/authorization');
      • $autoload['helper'] = array('language', 'url', 'account/ssl');
      • $autoload['model'] = array('account/account_model');
    6. Add the following to the end of app/config/constants.php

      /*
      |--------------------------------------------------------------------------
      | A3M Extras
      |--------------------------------------------------------------------------
      */
      /*
      * Define root resources folder name for js/css/img files
      */
      define('RES_DIR', 'resource');
      /*
      * Detect AJAX Request for MY_Session
      */
      define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && 
          strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
      /*
      * Portable PHP password hashing framework
      * http://www.openwall.com/phpass/
      */
      define('PHPASS_HASH_STRENGTH', 8);
      define('PHPASS_HASH_PORTABLE', FALSE);