此代码不起作用:
select *
from persons
where lower(email) = lower({email})
and (password = crypt('{password}', password))
and approved = 1
and now() between start_date and coalesce(end_date, current_timestamp );
我必须设置哈希的代码工作正常:
Insert into persons (
person_id
, name_first
, name_last
, email
, phone
, username
, password
, start_date
, approved
, superuser)
values
(
nextval('PERSON_ID_SEQ')
, {name_first}
, {name_last}
, {email}
, {phone}
, 'username'
, crypt('{password}', gen_salt('md5'))
, now()
, 0
, 0
)
但我似乎无法正确检查输入密码的哈希值。我想在 where 子句中进行检查,以便在匹配时返回 people 行。
在此先感谢马丁