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

Adapt Shield's email2FA in Bonfire2 #501

Merged
merged 3 commits into from
Jan 18, 2025

Conversation

dgvirtual
Copy link
Collaborator

@dgvirtual dgvirtual commented Jan 14, 2025

Finishes the incomplete implementation in pr #416, fixes #352

@dgvirtual
Copy link
Collaborator Author

For existing projects, this will also mean updating manually

app/Config/Auth.php

If you fail to do that and turn on the 2FA, you will get locked out of the website.

To solve the problem, you will have to issue this command on db:

DELETE FROM settings WHERE class="Config\Auth" AND key="actions"

Does this count as breaking change, and should it be mentioned in the CHANGELOG, I wonder?

@lonnieezell
Copy link
Owner

I would definitely add a note about the breaking change on this.

I would love to get this repo to a point where we can get an official 1.0 out. And then start actual versions, but I don't have an ounce of free time lately.

@dgvirtual
Copy link
Collaborator Author

@lonnieezell, I am thinking about a partial solution to breaking updates: have composer create a file in the project on install/update with last update date, and then add a php file that would be executed on composer update, where we could put time-based messages to be printed by composer, so user knows he needs to do something manually.

I am thinking of adding this to scripts in composer.json:

    "post-update-cmd": [
      "php post-update-messages.php"
    ]

and then a file post-update-messages.php in the project root(?):

// Set the cutoff date or commit hash
$cutoffDate = new DateTime('2025-01-01 00:00:00');
$lastUpdateFile = 'last-update.txt';

// Check if the last update file exists
if (file_exists($lastUpdateFile)) {
    $lastUpdateDate = new DateTime(file_get_contents($lastUpdateFile));
    if ($lastUpdateDate >= $cutoffDate) {
        // Exit if the last update was after the cutoff date
        exit(0);
    }
}

// Display the warning message
echo "Warning: After this update, you need to do some manual changes (like copying theme files or editing config files). Please see [documentation link] for details ....\n";

// Update the last update file
file_put_contents($lastUpdateFile, (new DateTime())->format(DateTime::ATOM));

Do you see any drawbacks to such approach?

I think we could even automate this somehow, so that the script reads the dates from the file with breaking changes, so we do not need to specify the cutoffDate manually.

Copy link
Collaborator Author

@dgvirtual dgvirtual left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed:

  • documentation update;
  • (prior to this) script to inform users of breaking changes at the end of composer update run

@dgvirtual dgvirtual force-pushed the feature/proper_Email2FA branch from 8b7a0a9 to fb5dbd9 Compare January 18, 2025 09:06
@dgvirtual dgvirtual merged commit 18971c1 into lonnieezell:develop Jan 18, 2025
6 checks passed
@dgvirtual dgvirtual deleted the feature/proper_Email2FA branch January 22, 2025 21:34
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

Successfully merging this pull request may close these issues.

Invalid file: "master.php"
2 participants