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

Fix email maximum length: an entire email address can be up to 254 ch… #167

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions migrations/m170307_100221_update_email_type.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

use yii\db\Migration;

class m170307_100221_update_email_type extends Migration
{
public function up()
{
$this->alterColumn('user', 'email', 'varchar(254)');
}

public function down()
{
echo "m170307_100221_update_email_type cannot be reverted.\n";

return false;
}

/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}

public function safeDown()
{
}
*/
}
2 changes: 1 addition & 1 deletion migrations/mysql.schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ CREATE TABLE IF NOT EXISTS `user` (
`updated_at` int(11) NOT NULL,
`registration_ip` varchar(15) DEFAULT NULL,
`bind_to_ip` varchar(255) DEFAULT NULL,
`email` varchar(128) DEFAULT NULL,
`email` varchar(254) DEFAULT NULL,
`email_confirmed` smallint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
Expand Down
2 changes: 1 addition & 1 deletion views/auth/confirmEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
'validateOnBlur'=>false,
]); ?>

<?= $form->field($model, 'email')->textInput(['maxlength' => 255, 'autofocus'=>true]) ?>
<?= $form->field($model, 'email')->textInput(['maxlength' => 254, 'autofocus'=>true]) ?>

<div class="form-group">
<div class="col-sm-offset-3 col-sm-9">
Expand Down
2 changes: 1 addition & 1 deletion views/auth/passwordRecovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
'validateOnBlur'=>false,
]); ?>

<?= $form->field($model, 'email')->textInput(['maxlength' => 255, 'autofocus'=>true]) ?>
<?= $form->field($model, 'email')->textInput(['maxlength' => 254, 'autofocus'=>true]) ?>

<?= $form->field($model, 'captcha')->widget(Captcha::className(), [
'template' => '<div class="row"><div class="col-sm-2">{image}</div><div class="col-sm-3">{input}</div></div>',
Expand Down
4 changes: 2 additions & 2 deletions views/user/_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

<?php if ( User::hasPermission('editUserEmail') ): ?>

<?= $form->field($model, 'email')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'email')->textInput(['maxlength' => 254]) ?>
<?= $form->field($model, 'email_confirmed')->checkbox() ?>

<?php endif; ?>
Expand All @@ -70,4 +70,4 @@

</div>

<?php BootstrapSwitch::widget() ?>
<?php BootstrapSwitch::widget() ?>