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

Making the verification and password reset token unqiue #15488

Merged
merged 5 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace Sylius\Bundle\CoreBundle\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
diimpp marked this conversation as resolved.
Show resolved Hide resolved
*/
final class Version20231103004216 extends AbstractMigration
{
public function getDescription(): string
{
return 'Making the uniqueness of the password_reset_token and email_verification_token a database constraint';
mamazu marked this conversation as resolved.
Show resolved Hide resolved
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
diimpp marked this conversation as resolved.
Show resolved Hide resolved
$this->addSql('CREATE UNIQUE INDEX UNIQ_88D5CC4D6B7BA4B6 ON sylius_admin_user (password_reset_token)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_88D5CC4DC4995C67 ON sylius_admin_user (email_verification_token)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_7C2B74806B7BA4B6 ON sylius_shop_user (password_reset_token)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_7C2B7480C4995C67 ON sylius_shop_user (email_verification_token)');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
diimpp marked this conversation as resolved.
Show resolved Hide resolved
$this->addSql('DROP INDEX UNIQ_88D5CC4D6B7BA4B6 ON sylius_admin_user');
$this->addSql('DROP INDEX UNIQ_88D5CC4DC4995C67 ON sylius_admin_user');
$this->addSql('DROP INDEX UNIQ_7C2B74806B7BA4B6 ON sylius_shop_user');
$this->addSql('DROP INDEX UNIQ_7C2B7480C4995C67 ON sylius_shop_user');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
<field name="encoderName" column="encoder_name" type="string" nullable="true" />

<field name="lastLogin" column="last_login" type="datetime" nullable="true" />
<field name="passwordResetToken" column="password_reset_token" type="string" nullable="true" />
<field name="passwordResetToken" column="password_reset_token" type="string" nullable="true" unique="true" />
diimpp marked this conversation as resolved.
Show resolved Hide resolved
<field name="passwordRequestedAt" column="password_requested_at" type="datetime" nullable="true" />
<field name="emailVerificationToken" column="email_verification_token" type="string" nullable="true" />
<field name="emailVerificationToken" column="email_verification_token" type="string" nullable="true" unique="true" />
<field name="verifiedAt" column="verified_at" type="datetime" nullable="true" />

<field name="locked" column="locked" type="boolean" nullable="false" />
Expand Down