Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
papnoisanjeev committed Jan 3, 2025
1 parent 32d4075 commit 1195808
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 51 deletions.
2 changes: 1 addition & 1 deletion INSTALLATION GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Navigate to localhost/index.php to verify that localhost is able to serve your s
With all these changes done, your apache server should be able to serve web resources from your new document root. You can further go ahead and configure your DNS records to point your domains to your server's IP at this step.
Downloading and setting up Composer
-----------------
------------------------------------
Follow the instructions provided on the official [composer website](https://getcomposer.org/download/) to download and install composer package manager. Once installed, it's advisable to move the composer executable to the /usr/local/bin/ directory so that it can be easily accessed from anywhere in your terminal. To do so, use the following commands:

Expand Down
2 changes: 1 addition & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function isRunningInDocker(): bool {
}

// Only attempt to set permissions if we're NOT in Docker
if (!isRunningInDocker()) {
if (! isRunningInDocker()) {
$basePath = dirname(__DIR__);
$files = [
'env' => $basePath . '/.env',
Expand Down
100 changes: 68 additions & 32 deletions public/scripts/wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
error500: {
title: 'Something\'s bad happened with the server.',
description: ' Try again by clicking the back button or launch the wizard again by refershing the webpage or clicking the cancel button.'
description: ' Try again by clicking the back button or launch the wizard again by refreshing the web page or clicking the cancel button.'
},
};

Expand Down Expand Up @@ -112,10 +112,13 @@
this.view = attributes.view;
},
getDefaultAttributes: function () {
// function to fetch current saved prefixes and will update values of defaults
// Function to fetch current saved prefixes and will update values of defaults
return new Promise ((resolve, reject) => {
$.get('./wizard/xhr/website-configure', (response) => {
if (typeof response.status != 'undefined' && true === response.status) {
if (
typeof response.status != 'undefined'
&& true === response.status
) {
this.defaults['member_panel_url'] = response.memberPrefix;
this.defaults['customer_panel_url'] = response.knowledgebasePrefix;
resolve();
Expand All @@ -130,7 +133,7 @@
},
isProcedureCompleted: function (callback) {
this.set('urlCollection', {
'member-prefix': this.view.$el.find('input[name="memeberUrlPrefix"]').val(),
'member-prefix': this.view.$el.find('input[name="memberUrlPrefix"]').val(),
'customer-prefix': this.view.$el.find('input[name="customerUrlPrefix"]').val(),
});

Expand Down Expand Up @@ -181,15 +184,21 @@
event.preventDefault();
this.$el.find('.form-content .wizard-form-notice').remove();

let memberPrefix = this.$el.find('input[name="memeberUrlPrefix"]').val();
let memberPrefix = this.$el.find('input[name="memberUrlPrefix"]').val();
let customerPrefix = this.$el.find('input[name="customerUrlPrefix"]').val();

if (memberPrefix == null || memberPrefix =="") {
if (
memberPrefix == null
|| memberPrefix == ""
) {
errorFlag = true;
this.$el.find('.form-content input[name="memeberUrlPrefix"]').after("<span class='wizard-form-notice'>This field is mandatory</span>")
this.$el.find('.form-content input[name="memberUrlPrefix"]').after("<span class='wizard-form-notice'>This field is mandatory</span>")
}

if (customerPrefix == null || customerPrefix =="") {
if (
customerPrefix == null
|| customerPrefix == ""
) {
errorFlag = true;
this.$el.find('.form-content input[name="customerUrlPrefix"]').after("<span class='wizard-form-notice'>This field is mandatory</span>")
}
Expand All @@ -199,15 +208,15 @@
this.$el.find('.form-content input[name="customerUrlPrefix"]').after("<span class='wizard-form-notice'>Both prefixes can not be same.</span>")
}

if (!errorFlag) {
if (! errorFlag) {
let prefixTestRegex = /^[a-z0-9A-Z]*$/;

if (!prefixTestRegex.test(memberPrefix)) {
if (! prefixTestRegex.test(memberPrefix)) {
errorFlag = true;
this.$el.find('.form-content input[name="memeberUrlPrefix"]').after("<span class='wizard-form-notice'>Only letters and numbers are allowed</span>")
this.$el.find('.form-content input[name="memberUrlPrefix"]').after("<span class='wizard-form-notice'>Only letters and numbers are allowed</span>")
}

if (!prefixTestRegex.test(customerPrefix)) {
if (! prefixTestRegex.test(customerPrefix)) {
errorFlag = true;
this.$el.find('.form-content input[name="customerUrlPrefix"]').after("<span class='wizard-form-notice'>Only letters and numbers are allowed</span>")
}
Expand Down Expand Up @@ -250,7 +259,10 @@
wizard.reference_nodes.content.find('#wizardCTA-IterateInstallation').prepend('<span class="processing-request">' + wizard.wizard_icons_loader_template() + '</span>');

$.post('./wizard/xhr/intermediary/super-user', this.get('user'), function (response) {
if (typeof response.status != 'undefined' && true === response.status) {
if (
typeof response.status != 'undefined'
&& true === response.status
) {
callback(this.view);
} else {
wizard.disableNextStep();
Expand Down Expand Up @@ -301,41 +313,66 @@

enteredField = event.target.name;
enteredValue = event.target.value;
if (enteredValue == null || enteredValue == "") {
if (
enteredValue == null
|| enteredValue == ""
) {
errorFlag = true;
selectedElement.find('.wizard-form-notice')
selectedElement.append("<span class='wizard-form-notice'>This field is mandatory</span>");
}

if (!errorFlag && user.name) {
if (!nameRegex.test(user.name)) {
if (
! errorFlag
&& user.name
) {
if (! nameRegex.test(user.name)) {
errorFlag = true;
this.$el.find('input[name="name"]').parent().append("<span class='wizard-form-notice'>Invalid Name</span>")
}
}

if (!errorFlag && user.email !== "") {
if (!emailRegex.test(user.email)) {
if (
! errorFlag
&& user.email !== ""
) {
if (! emailRegex.test(user.email)) {
errorFlag = true;
this.$el.find('input[name="email"]').parent().append("<span class='wizard-form-notice'>Invalid Email</span>")
}
}

if (user.password.length > 0 && (!passwordRegix.test(user.password))) {
errorFlag = true;
this.$el.find('input[name="password"]').parent().append("<span class='wizard-form-notice'>Password must contain minimum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed).</span>")
if (
user.password.length > 0
&& (! passwordRegix.test(user.password))
) {
errorFlag = true;
this.$el.find('input[name="password"]').parent().append("<span class='wizard-form-notice'>Password must contain minimum 8 character length, at least two letters (not case sensitive), one number, one special character(space is not allowed).</span>")
}

if (user.confirmPassword.length > 0 && user.confirmPassword != user.password) {
if (
user.confirmPassword.length > 0
&& user.confirmPassword != user.password
) {
errorFlag = true;
this.$el.find('input[name="confirm_password"]').parent().append("<span class='wizard-form-notice'>Password does not match.</span>")
}

if (!errorFlag && (user.name == null || user.name =="") || (user.email == null || user.email =="") || (user.password == null || user.password =="") || (user.confirmPassword == null || user.confirmPassword ==""))
if (
! errorFlag
&& (user.name == null
|| user.name == "")
|| (user.email == null
|| user.email =="")
|| (user.password == null
|| user.password =="")
|| (user.confirmPassword == null
|| user.confirmPassword == "")
) {
errorFlag = true;


if (!errorFlag) {
}
if (! errorFlag) {
this.wizard.enableNextStep();

if (event.keyCode == 13) {
Expand All @@ -345,7 +382,6 @@
} else {
this.wizard.disableNextStep();
}

}, 400),
});

Expand Down Expand Up @@ -631,16 +667,16 @@
} else if (this.get('php-configfiles-permission').hasOwnProperty('configfiles')) {
let configfiles = this.get('php-configfiles-permission').configfiles;

let isconfigfilesError;
let isConfigFilesError;
configfiles.forEach(configfiles => {
let currentconfigfileName = Object.keys(configfiles)[0];
if (!configfiles[currentconfigfileName]) {
isconfigfilesError = true;
isConfigFilesError = true;
this.set('verified', false);
}
});

if (!isconfigfilesError) {
if (! isConfigFilesError) {
this.set('verified', true);
}
} else if (this.get('php-extensions').hasOwnProperty('extensions')) {
Expand All @@ -655,7 +691,7 @@
}
});

if (!isExtensionError) {
if (! isExtensionError) {
this.set('verified', true);
}
} else {
Expand Down Expand Up @@ -1083,7 +1119,7 @@

this.renderWizard();
} else {
if (!this.enabled) {
if (! this.enabled) {
this.router.navigate('welcome', { trigger: true });
} else {
this.timeline.every(function (installationStep, index) {
Expand Down
24 changes: 12 additions & 12 deletions src/Console/Wizard/ConfigureHelpdesk.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,15 +447,15 @@ public static function addUserDetailsInTracker($userDetails = [])
private function refreshDatabaseConnection($host, $port, $name, $user, $password)
{
$response = [
'isServerAccessible' => true,
'isServerAccessible' => true,
'isDatabaseAccessible' => true,
];

$entityManager = EntityManager::create([
'driver' => 'pdo_mysql',
"host" => $host,
"port" => $port,
'user' => $user,
'driver' => 'pdo_mysql',
"host" => $host,
"port" => $port,
'user' => $user,
'password' => $password,
], Setup::createAnnotationMetadataConfiguration(['src/Entity'], false));

Expand All @@ -471,7 +471,7 @@ private function refreshDatabaseConnection($host, $port, $name, $user, $password
}
}

if (!in_array($name, $databaseConnection->getSchemaManager()->listDatabases())) {
if (! in_array($name, $databaseConnection->getSchemaManager()->listDatabases())) {
$response['isDatabaseAccessible'] = false;
}

Expand All @@ -492,10 +492,10 @@ private function refreshDatabaseConnection($host, $port, $name, $user, $password
private function createDatabase($host, $port, $name, $user, $password)
{
$entityManager = EntityManager::create([
'driver' => 'pdo_mysql',
"host" => $host,
"port" => $port,
'user' => $user,
'driver' => 'pdo_mysql',
"host" => $host,
"port" => $port,
'user' => $user,
'password' => $password,
], Setup::createAnnotationMetadataConfiguration(['src/Entity'], false));

Expand All @@ -509,7 +509,7 @@ private function createDatabase($host, $port, $name, $user, $password)
}
}

if (!in_array($name, $databaseConnection->getSchemaManager()->listDatabases())) {
if (! in_array($name, $databaseConnection->getSchemaManager()->listDatabases())) {
try {
// Create database
$databaseConnection->getSchemaManager()->createDatabase($databaseConnection->getDatabasePlatform()->quoteSingleIdentifier($name));
Expand Down Expand Up @@ -592,7 +592,7 @@ private function askInteractiveQuestion($question, $default, int $indentLength =
$this->consoleOutput->write(false == $flag ? [self::MCA, self::CLL] : [self::MCA, self::CLL, self::MCA, self::CLL]);

if (empty($input) && false == $nullable && empty($default)) {
if (!empty($default)) {
if (! empty($default)) {
$input = $default;
} else if (false == $nullable) {
$flag = true;
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Wizard/DefaultUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private function promptUserPasswordInteractively(InputInterface $input, OutputIn
$output->writeln(sprintf(" <comment>Warning</comment>: %sPassword cannot be left blank", $confirmDialog ? 'Confirm ' : ''));
} else if (false == $confirmDialog && (strlen($password) < 8 || strlen($password) > 32)) {
$warningFlag = true;
// Sanatize password and compare if they match
// Sanitize password and compare if they match
$output->writeln(" <comment>Warning</comment>: Password needs to be 8-32 characters long");
$password = null;
}
Expand Down
9 changes: 6 additions & 3 deletions src/Console/Wizard/MigrateDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
->compareMigrations($output)
->getLatestMigrationVersion(new BufferedOutput());

if (('0' != $currentMigrationVersion && $currentMigrationVersion != $latestMigrationVersion) || ($currentMigrationVersion != $latestMigrationVersion)) {
if (
('0' != $currentMigrationVersion && $currentMigrationVersion != $latestMigrationVersion)
|| ($currentMigrationVersion != $latestMigrationVersion)
) {
$this->migrateDatabaseToLatestVersion(new NullOutput());
}
} catch (NoChangesDetected $e) {
Expand All @@ -80,8 +83,8 @@ private function versionMigrations(OutputInterface $consoleOutput)
$command = $this->getApplication()->find('doctrine:migrations:version');
($consoleOptions = new ConsoleOptions([
'command' => 'migrations:version',
'--add' => true,
'--all' => true,
'--add' => true,
'--all' => true,
'--quiet' => true
]))->setInteractive(false);

Expand Down
2 changes: 1 addition & 1 deletion templates/installation-wizard/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
<div class="form-field">
<label class="form-label">Member Panel Prefix<span class="uv-mandatory">*</span></label>
<div class="form-content">
<input name="memeberUrlPrefix" type="text" value="<%- member_panel_url %>" placeholder="member" class="form-content"/>
<input name="memberUrlPrefix" type="text" value="<%- member_panel_url %>" placeholder="member" class="form-content"/>
</div>
</div>
<div class="form-field">
Expand Down

0 comments on commit 1195808

Please sign in to comment.