1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
userpasswordtable.php
См. документацию.
1<?php
8
9namespace Bitrix\Main\Authentication\Internal;
10
11use Bitrix\Main;
12use Bitrix\Main\ORM\Query\Join;
13use Bitrix\Main\ORM\Data;
14use Bitrix\Main\ORM\Fields;
15
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
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}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static getUserPasswords($userId, $limit)
Определения userpasswordtable.php:77
static getEntity()
Определения datamanager.php:65