1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
userpasswordtable.php
См. документацию.
1
<?php
8
9
namespace
Bitrix\Main\Authentication\Internal;
10
11
use Bitrix\Main;
12
use Bitrix\Main\ORM\Query\Join;
13
use Bitrix\Main\ORM\Data;
14
use Bitrix\Main\ORM\Fields;
15
32
class
UserPasswordTable
extends
Data\DataManager
33
{
34
use Data\Internal\DeleteByFilterTrait;
35
36
public
static
function
getTableName
()
37
{
38
return
'b_user_password'
;
39
}
40
41
public
static
function
getMap
()
42
{
43
return
[
44
(
new
Fields\IntegerField
(
"ID"
))
45
->configurePrimary(
true
)
46
->configureAutocomplete(
true
),
47
48
(
new
Fields\IntegerField
(
"USER_ID"
))
49
->addValidator(
new
Fields
\
Validators
\ForeignValidator(
Main
\
UserTable::getEntity
()->getField(
'ID'
))),
50
51
(
new
Fields\StringField
(
"PASSWORD"
)),
52
53
(
new
Fields
\
DatetimeField
(
"DATE_CHANGE"
)),
54
55
(
new
Fields\Relations\Reference
(
56
'USER'
,
57
Main
\UserTable::class,
58
Join::on(
'this.USER_ID'
,
'ref.ID'
)
59
))->configureJoinType(
'inner'
),
60
];
61
}
62
63
public
static
function
passwordExpired
(
$userId
, $days)
64
{
65
$date =
new
Main\Type\DateTime
();
66
$date->add(
"-{$days}D"
);
67
68
$prevPassword = static::query()
69
->where(
"USER_ID"
,
$userId
)
70
->where(
"DATE_CHANGE"
,
">"
, $date)
71
->setLimit(1)
72
->fetch();
73
74
return
!$prevPassword;
75
}
76
77
public
static
function
getUserPasswords
(
$userId
, $limit)
78
{
79
return
static::query()
80
->addSelect(
"PASSWORD"
)
81
->addSelect(
"DATE_CHANGE"
)
82
->where(
"USER_ID"
,
$userId
)
83
->addOrder(
"ID"
,
"DESC"
)
84
->setLimit($limit)
85
->fetchAll();
86
}
87
}
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Main\Authentication\Internal\UserPasswordTable
Определения
userpasswordtable.php:33
Bitrix\Main\Authentication\Internal\UserPasswordTable\getMap
static getMap()
Определения
userpasswordtable.php:41
Bitrix\Main\Authentication\Internal\UserPasswordTable\getUserPasswords
static getUserPasswords($userId, $limit)
Определения
userpasswordtable.php:77
Bitrix\Main\Authentication\Internal\UserPasswordTable\passwordExpired
static passwordExpired($userId, $days)
Определения
userpasswordtable.php:63
Bitrix\Main\Authentication\Internal\UserPasswordTable\getTableName
static getTableName()
Определения
userpasswordtable.php:36
Bitrix\Main\ORM\Data\DataManager
Определения
datamanager.php:35
Bitrix\Main\ORM\Data\DataManager\getEntity
static getEntity()
Определения
datamanager.php:65
Bitrix\Main\ORM\Fields\DatetimeField
Определения
datetimefield.php:22
Bitrix\Main\ORM\Fields\IntegerField
Определения
integerfield.php:20
Bitrix\Main\ORM\Fields\Relations\Reference
Определения
reference.php:26
Bitrix\Main\ORM\Fields\StringField
Определения
stringfield.php:20
Bitrix\Main\Type\DateTime
Определения
datetime.php:9
Bitrix\Main\ORM\Fields\Validators
Определения
booleanvalidator.php:9
Bitrix\Main\ORM\Fields
Определения
arrayfield.php:9
Bitrix\Main
bitrix
modules
main
lib
authentication
internal
userpasswordtable.php
Создано системой
1.14.0