Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user and password can't reset?[vtiger] #198

Closed
qiaofeng1227 opened this issue May 30, 2022 · 4 comments
Closed

user and password can't reset?[vtiger] #198

qiaofeng1227 opened this issue May 30, 2022 · 4 comments

Comments

@qiaofeng1227
Copy link
Contributor

https://github.com/javanile/vtiger/blob/master/Dockerfile.main.template

ENV VT_ADMIN_USER="admin" \
    VT_ADMIN_PASSWORD="admin" \
    VT_ADMIN_EMAIL="admin@localhost.lan" \
    VT_CURRENCY_NAME="USA, Dollars" \
    VT_SCHEDULER=1 \
    VT_INSTALL=1 \
    MYSQL_HOST="mysql" \
    MYSQL_DATABASE="vtiger"
@qiaofeng1227
Copy link
Contributor Author

qiaofeng1227 commented Jun 15, 2022

root@6e5736368262:/var/www/html# cat /usr/src/vtiger/vtiger-startup.php
<?php

require_once __DIR__.'/vtiger-autoload.php';

function encrypt_password($username, $user_password, $crypt_type = '')
{
    $salt = substr($username, 0, 2);
    if ($crypt_type == '') {
        $crypt_type = 'MD5';
    }
    if ($crypt_type == 'MD5') {
        $salt = '$1$'.$salt.'$';
    } elseif ($crypt_type == 'BLOWFISH') {
        $salt = '$2$'.$salt.'$';
    } elseif ($crypt_type == 'PHP5.3MD5') {
        $salt = '$1$'.str_pad($salt, 9, '0');
    }
    $encrypted_password = crypt($user_password, $salt);

    return $encrypted_password;
}

echo "[vtiger] Looking for database...\n";
if (!$db = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT)) {
    echo '[vtiger] Database: '.mysqli_connect_errno().' - '.mysqli_connect_error()."\n";
    //exit(1);
}

echo "[vtiger] Update administrator settings\n";
if (!file_exists($lock = __DIR__.'/startup.lock')) {
    // update password
    /*
    $username = getenv('VT_ADMIN_USER') ?: 'admin';
    $password = encrypt_password($username, getenv('VT_ADMIN_PASSWORD') ?: 'admin');
    mysqli_query($db, "
        UPDATE vtiger_users
        SET user_name = '{$username}'
          , user_password = '{$password}'
          , crypt_type = ''
        WHERE id = '1'
    ");
    file_put_contents($lock, json_encode(['lock' => true]));
    */
}

@qiaofeng1227
Copy link
Contributor Author

refer to: javanile/vtiger#41

@qiaofeng1227 qiaofeng1227 changed the title user and password can't reset? user and password can't reset?[vtiger] Oct 20, 2022
@qiaofeng1227 qiaofeng1227 transferred this issue from Websoft9test/docker-vtiger Oct 20, 2022
@chendelin1982
Copy link
Contributor

  1. install wizard script: https://github.com/javanile/vtiger/blob/master/7.2.0/vtiger-install.php
  2. docker startup.php: /usr/src/vtiger/vtiger-startup.php

@chendelin1982
Copy link
Contributor

refer to: #235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants