Skip to content

Commit

Permalink
Merge pull request #843 from hanazarraa/validate-step1-installer
Browse files Browse the repository at this point in the history
  • Loading branch information
GhaziTriki authored Jul 25, 2023
2 parents 0b53cf9 + e916ae6 commit ee17655
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
3 changes: 0 additions & 3 deletions bbbeasy-backend/app/src/Actions/Core/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ public function execute($f3, $params): void
$setting = new Setting();
$dataChecker = new DataChecker();

$dataChecker->verify($form['username'], Validator::length(4)->setName('username'));
$dataChecker->verify($form['email'], Validator::email()->setName('email'));
$dataChecker->verify($form['password'], Validator::length(8)->setName('password'));
$dataChecker = $setting->checkSettingsData($dataChecker, $form);
$dataChecker->verify($form['presetsConfig'], Validator::notEmpty()->setName('presetsConfig'));

Expand Down
3 changes: 1 addition & 2 deletions bbbeasy-backend/app/src/Models/Preset.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ public function getPresetSettings(): array
$presetSett = new PresetSetting();

foreach ($attributes as $attribute) {

$presetSettings = $presetSett->getByNameAndGroup($attribute,$categoryName);
$presetSettings = $presetSett->getByNameAndGroup($attribute, $categoryName);

if (!$presetSettings->dry() && $presetSettings->enabled) {
if (!$settings[$categoryName]) {
Expand Down
5 changes: 2 additions & 3 deletions bbbeasy-backend/app/src/Models/PresetSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,13 @@ public function getByName(string $name): self
return $this;
}

public function getByNameAndGroup(string $name,string $group): self
public function getByNameAndGroup(string $name, string $group): self
{
$this->load(['name = ? and group = ? ', $name,$group]);
$this->load(['name = ? and group = ? ', $name, $group]);

return $this;
}


public function savePresetSettings(array $presets): bool|string
{
foreach ($presets as $preset) {
Expand Down
14 changes: 12 additions & 2 deletions bbbeasy-frontend/src/components/Install.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { PresetType } from '../types/PresetType';

import axios from 'axios';
import { apiRoutes } from '../routing/backend-config';
import usersService from 'services/users.service';

const { Step } = Steps;

Expand Down Expand Up @@ -229,8 +230,17 @@ const Install = () => {

const onFinish = () => {
const stepsData: formType = stepForm.getFieldsValue(true);

if (activeStep < steps.length - 1) {
if (activeStep == 0) {
setMessage('');
usersService
.collect_users(stepsData)
.then(() => {
next();
})
.catch((error) => {
setMessage(error.response.data.message);
});
} else if (activeStep < steps.length - 1) {
next();
} else {
//edit file
Expand Down

0 comments on commit ee17655

Please sign in to comment.