Results 1 to 5 of 5

Thread: Importing Users From Another Application

  1. #1
    tkearl is offline Member
    Join Date
    Oct 2008
    Posts
    8

    Exclamation Importing Users From Another Application

    I am using version 5.1 and I want to convert my company from another CRM product. When I try to import the user/employee records there is no way to map their current passwords. WHY? Is it possible for me to do this?? I want to make the transition as smooth as possible. ANY IDEAS?

    TK

  2. #2
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Importing Users From Another Application

    It's nearly impossible to import passwords because of not knowing how they are stored in the legacy system. Obviously, clear text isn't as hard. The issue is when they are hashed, encrypted, etc. If you are really experienced you may be able to programmatically convert the passwords from your old system to Sugar.

  3. #3
    tkearl is offline Member
    Join Date
    Oct 2008
    Posts
    8

    Default Re: Importing Users From Another Application

    The passwords are plain text so there is no encryption. How would I import??

  4. #4
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Importing Users From Another Application

    Hi TK

    Use the MD5() function to encrypt it.

    If you are going to export directly from the other database: SELECT MD5(password_field) AS password_field.
    Where password_field is the name of the field into other database which store the password.

    If you are going to encrypt through php: $password = md5($password);

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  5. #5
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Importing Users From Another Application

    Exactly as Andopes stated. Here's the function in Sugar used to save the password:

    PHP Code:
        function change_password($user_password$new_password) {
            global 
    $mod_strings;
            global 
    $current_user;
            
    $GLOBALS['log']->debug("Starting password change for $this->user_name");

            if (!isset (
    $new_password) || $new_password == "") {
                
    $this->error_string $mod_strings['ERR_PASSWORD_CHANGE_FAILED_1'].$current_user['user_name'].$mod_strings['ERR_PASSWORD_CHANGE_FAILED_2'];
                return 
    false;
            }

            
    $old_user_hash strtolower(md5($user_password));

            if (!
    is_admin($current_user)) {
                
    //check old password first
                
    $query "SELECT user_name FROM $this->table_name WHERE user_hash='$old_user_hash' AND id='$this->id'";
                
    $result $this->db->query($querytrue);
                
    $row $this->db->fetchByAssoc($result);
                
    $GLOBALS['log']->debug("select old password query: $query");
                
    $GLOBALS['log']->debug("return result of $row");

                if (
    $row == null) {
                    
    $GLOBALS['log']->warn("Incorrect old password for ".$this->user_name."");
                    
    $this->error_string $mod_strings['ERR_PASSWORD_INCORRECT_OLD_1'].$this->user_name.$mod_strings['ERR_PASSWORD_INCORRECT_OLD_2'];
                    return 
    false;
                }
            }

            
    $user_hash strtolower(md5($new_password));

            
    //set new password
            
    $query "UPDATE $this->table_name SET user_hash='$user_hash' where id='$this->id'";
            
    $this->db->query($querytrue"Error setting new password for $this->user_name: ");
            return 
    true;
        } 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Importing users problems
    By anthony5104 in forum Help
    Replies: 2
    Last Post: 2007-11-28, 11:13 AM
  2. Replies: 4
    Last Post: 2007-10-12, 09:50 AM
  3. Management of users for external application
    By hectorimet in forum Developer Help
    Replies: 3
    Last Post: 2006-10-16, 12:00 PM
  4. Importing Users
    By cfgurney in forum Help
    Replies: 5
    Last Post: 2006-03-08, 11:03 PM
  5. Replies: 0
    Last Post: 2006-03-06, 05:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •