added record.PasswordHash() getter

This commit is contained in:
Gani Georgiev
2022-11-06 11:04:04 +02:00
parent 65693d1916
commit 46dc6cc47c
2 changed files with 21 additions and 4 deletions

View File

@@ -1603,6 +1603,20 @@ func TestRecordLastVerificationSentAt(t *testing.T) {
}
}
func TestRecordPasswordHash(t *testing.T) {
m := models.NewRecord(&models.Collection{})
if v := m.PasswordHash(); v != "" {
t.Errorf("Expected PasswordHash() to be empty, got %v", v)
}
m.Set(schema.FieldNamePasswordHash, "test")
if v := m.PasswordHash(); v != "test" {
t.Errorf("Expected PasswordHash() to be 'test', got %v", v)
}
}
func TestRecordValidatePassword(t *testing.T) {
// 123456
hash := "$2a$10$YKU8mPP8sTE3xZrpuM.xQuq27KJ7aIJB2oUeKPsDDqZshbl5g5cDK"