-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue an alert on change of email or password
- Loading branch information
Spine
authored and
itismadness
committed
Aug 15, 2021
1 parent
2ea52b8
commit e981041
Showing
14 changed files
with
181 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
db/migrations/20210720085440_users_history_passwords_now.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
final class UsersHistoryPasswordsNow extends AbstractMigration | ||
{ | ||
public function up(): void { | ||
$this->table('users_history_passwords') | ||
->changeColumn('ChangeTime', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']) | ||
->addColumn('useragent', 'string', ['limit' => 768, 'encoding' => 'ascii', 'null' => true]) | ||
->save(); | ||
|
||
$this->execute("UPDATE users_history_passwords SET useragent = 'unknown'"); | ||
|
||
$this->table('users_history_passwords') | ||
->changeColumn('useragent', 'string', ['limit' => 768, 'encoding' => 'ascii', 'null' => false]) | ||
->save(); | ||
} | ||
|
||
public function down(): void { | ||
$this->table('users_history_passwords') | ||
->changeColumn('ChangeTime', 'datetime', ['null' => false]) | ||
->removeColumn('useragent') | ||
->save(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
db/migrations/20210720093846_users_history_email_useragent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
final class UsersHistoryEmailUseragent extends AbstractMigration | ||
{ | ||
public function up(): void { | ||
$this->table('users_history_emails') | ||
->addColumn('useragent', 'string', ['limit' => 768, 'encoding' => 'ascii', 'null' => true]) | ||
->save(); | ||
|
||
$this->execute("UPDATE users_history_emails SET useragent = 'unknown'"); | ||
|
||
$this->table('users_history_emails') | ||
->changeColumn('useragent', 'string', ['limit' => 768, 'encoding' => 'ascii', 'null' => false]) | ||
->save(); | ||
} | ||
|
||
public function down(): void { | ||
$this->table('users_history_emails') | ||
->removeColumn('useragent') | ||
->save(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,13 +96,15 @@ public function run() { | |
'UserID' => $adminId, | ||
'Email' => '[email protected]', | ||
'Time' => Literal::from('now()'), | ||
'IP' => '127.0.0.1' | ||
'IP' => '127.0.0.1', | ||
'useragent' => 'initial-seed', | ||
], | ||
[ | ||
'UserID' => $userId, | ||
'Email' => '[email protected]', | ||
'Time' => Literal::from('now()'), | ||
'IP' => '127.0.0.1' | ||
'IP' => '127.0.0.1', | ||
'useragent' => 'initial-seed', | ||
] | ||
])->saveData(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Dear {{ username }}, | ||
|
||
At {{ now }} UTC, a request from {{ ipaddr }} was received | ||
to change your email address for {{ constant('SITE_NAME') }}. | ||
|
||
The new address is {{ new_email }} . Please take a moment to | ||
verify that you did not made a mistake when entering it. | ||
|
||
If you made this change then you may safely ignore this message. | ||
|
||
If you did not request this change yourself, or do not recognize the | ||
address, then either someone has guessed your password or you left a | ||
session logged in somewhere. In either case, you should contact us | ||
immediately. Come to {{ constant('BOT_SERVER') }} and join the {{ constant('BOT_DISABLED_CHAN') }} channel. | ||
|
||
If you receive another email saying your password was changed | ||
and you did not request it, you account has almost certainly | ||
been taken over by a third party. | ||
|
||
The useragent string sent by the browser was: | ||
{{ user_agent }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Dear {{ username }}, | ||
|
||
At {{ now }} UTC, a request from {{ ipaddr }} was received | ||
to change your password for {{ constant('SITE_NAME') }}. | ||
|
||
If you made this change then you may safely ignore this message. | ||
|
||
If you did not request this change yourself then either someone has | ||
guessed your existing password or you left a session logged in | ||
somewhere. In either case, you should contact us immediately. | ||
Come to {{ constant('BOT_SERVER') }} and join the {{ constant('BOT_DISABLED_CHAN') }} channel. | ||
|
||
If you receive another email saying your email address was | ||
changed and you did not request it, you account has almost | ||
certainly been taken over by a third party. | ||
|
||
The useragent string sent by the browser was: | ||
{{ user_agent }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.