Добавлен action для формы восстановления пароля

This commit is contained in:
ErickSkrauch
2016-05-10 23:25:04 +03:00
parent a29cb76cbf
commit c6547b6540
8 changed files with 166 additions and 12 deletions

View File

@@ -0,0 +1,24 @@
<?php
namespace common\helpers;
class StringHelper {
public static function getEmailMask($email) {
$username = explode('@', $email)[0];
$usernameLength = mb_strlen($username);
$maskChars = '**';
if ($usernameLength === 1) {
$mask = $maskChars;
} elseif($usernameLength === 2) {
$mask = mb_substr($username, 0, 1) . $maskChars;
} elseif($usernameLength === 3) {
$mask = mb_substr($username, 0, 1) . $maskChars . mb_substr($username, 2, 1);
} else {
$mask = mb_substr($username, 0, 2) . $maskChars . mb_substr($username, -2, 2);
}
return $mask . mb_substr($email, $usernameLength);
}
}