forked from OpenVK/openvk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Users: Add ability to change email address in settings
Closes OpenVK#63
- Loading branch information
Showing
10 changed files
with
385 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<meta name="viewport" content="width=device-width" /> | ||
<title>Подтверждение изменения Email</title> | ||
<link rel="stylesheet" href="foundation.css" /> | ||
<style> | ||
.container { | ||
border-top: 5px solid pink; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<table class="body" data-made-with-foundation=""> | ||
<tr> | ||
<td class="float-center" align="center" valign="top"> | ||
<center> | ||
<table class="spacer"> | ||
<tr> | ||
<td> | ||
| ||
</td> | ||
</tr> | ||
</table> | ||
<table class="container"> | ||
<tr> | ||
<td> | ||
<table class="row header"> | ||
<tr> | ||
<th class="small-12 large-12 columns first last"> | ||
<table> | ||
<tr> | ||
<th> | ||
<table class="spacer"> | ||
<tr> | ||
<td> | ||
| ||
</td> | ||
</tr> | ||
</table> | ||
<h4 class="text-center">Подтверждение изменения Email</h4> | ||
</th> | ||
</tr> | ||
</table> | ||
</th> | ||
</tr> | ||
</table> | ||
|
||
<table class="row"> | ||
<tr> | ||
<th class="small-12 large-12 columns first last"> | ||
<table class="row"> | ||
<tr> | ||
<td> | ||
<center> | ||
<img src="pictures/lock.jpeg" align="center" class="float-center" width=128 height=128 /> | ||
</center> | ||
|
||
<table class="spacer"> | ||
<tr> | ||
<td> | ||
| ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<hr/> | ||
|
||
<table class="spacer"> | ||
<tr> | ||
<td> | ||
| ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<p class="text-left"> | ||
Здравствуйте, {$name}! Вы вероятно изменили свой адрес электронной почты в OpenVK. Чтобы изменение вступило в силу, необходимо подтвердить ваш новый Email. | ||
</p> | ||
|
||
<table class="spacer"> | ||
<tr> | ||
<td> | ||
| ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<table class="button large expand success"> | ||
<tr> | ||
<td> | ||
<table> | ||
<tr> | ||
<td> | ||
<center> | ||
<a href="http://{$_SERVER['HTTP_HOST']}/settings/change_email?key={rawurlencode($key)}" align="center" class="float-center">Подтвердить Email!</a> | ||
</center> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<table class="spacer"> | ||
<tr> | ||
<td> | ||
| ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<p class="text-left"> | ||
Если кнопка не работает, вы можете попробовать скопировать и вставить эту ссылку в адресную строку вашего веб-обозревателя: | ||
</p> | ||
|
||
<table class="callout"> | ||
<tr> | ||
<th class="callout-inner primary"> | ||
<a href="http://{$_SERVER['HTTP_HOST']}/settings/change_email?key={$key}" style="color: #000; text-decoration: none;"> | ||
http://{$_SERVER['HTTP_HOST']}/settings/change_email?key={$key} | ||
</a> | ||
</th> | ||
</tr> | ||
</table> | ||
|
||
<p class="text-left"> | ||
Обратите внимание на то, что эту ссылку нельзя: | ||
</p> | ||
|
||
<ul> | ||
<li>Передавать другим людям (даже друзьям, питомцам, соседам, любимым девушкам)</li> | ||
<li>Использовать, если прошло более двух дней с её генерации</li> | ||
</ul> | ||
|
||
<table class="callout"> | ||
<tr> | ||
<th class="callout-inner alert"> | ||
<p> | ||
Ещё раз <b>обратите внимание</b> на то, что данную ссылку или письмо <b>ни в коем случае нельзя</b> передавать другим людям! Даже если они представляются службой поддержки.<br/> | ||
Это письмо предназначено исключительно для одноразового, <b>непосредственного</b> использования владельцем аккаунта. | ||
</p> | ||
</th> | ||
</tr> | ||
</table> | ||
|
||
<table class="spacer"> | ||
<tr> | ||
<td> | ||
| ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<p class="text-right"> | ||
С уважением, овк-тян. | ||
</p> | ||
|
||
<table class="spacer"> | ||
<tr> | ||
<td> | ||
| ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<hr/> | ||
|
||
<table class="spacer"> | ||
<tr> | ||
<td> | ||
| ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<p class="text-left"> | ||
<small> | ||
Вы получили это письмо так как кто-то или вы изменили адрес электронной почты. Это не рассылка и от неё нельзя отписаться. Если вы всё равно хотите перестать получать подобные письма, деактивируйте ваш аккаунт. | ||
</small> | ||
</p> | ||
</td> | ||
</tr> | ||
</table> | ||
</th> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
<table class="spacer"> | ||
<tr> | ||
<td> | ||
| ||
</td> | ||
</tr> | ||
</table> | ||
</center> | ||
</td> | ||
</tr> | ||
</table> | ||
</body> | ||
</html> |
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,15 @@ | ||
<?php declare(strict_types=1); | ||
namespace openvk\Web\Models\Entities; | ||
use openvk\Web\Models\Repositories\Users; | ||
use openvk\Web\Models\RowModel; | ||
use openvk\Web\Util\DateTime; | ||
|
||
class EmailChangeVerification extends PasswordReset | ||
{ | ||
protected $tableName = "email_change_verifications"; | ||
|
||
function getNewEmail(): string | ||
{ | ||
return $this->getRecord()->new_email; | ||
} | ||
} |
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,33 @@ | ||
<?php declare(strict_types=1); | ||
namespace openvk\Web\Models\Repositories; | ||
use Chandler\Database\DatabaseConnection; | ||
use openvk\Web\Models\Entities\EmailChangeVerification; | ||
use openvk\Web\Models\Entities\User; | ||
use Nette\Database\Table\ActiveRow; | ||
|
||
class EmailChangeVerifications | ||
{ | ||
private $context; | ||
private $verifications; | ||
|
||
function __construct() | ||
{ | ||
$this->context = DatabaseConnection::i()->getContext(); | ||
$this->verifications = $this->context->table("email_change_verifications"); | ||
} | ||
|
||
function toEmailChangeVerification(?ActiveRow $ar): ?EmailChangeVerification | ||
{ | ||
return is_null($ar) ? NULL : new EmailChangeVerification($ar); | ||
} | ||
|
||
function getByToken(string $token): ?EmailChangeVerification | ||
{ | ||
return $this->toEmailChangeVerification($this->verifications->where("key", $token)->fetch()); | ||
} | ||
|
||
function getLatestByUser(User $user): ?EmailChangeVerification | ||
{ | ||
return $this->toEmailChangeVerification($this->verifications->where("profile", $user->getId())->order("timestamp DESC")->fetch()); | ||
} | ||
} |
Oops, something went wrong.