Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7511389
password.subtest.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
password.subtest.ts
View Options
import
assert
from
"assert"
;
import
{
withRunningApp
}
from
"../../../test_utils/with-test-app"
;
import
SecureHasher
from
"../../../utils/secure-hasher"
;
import
type
{
App
}
from
"../../app"
;
describe
(
"password"
,
()
=>
{
const
password
=
"it-really-doesnt-matter"
;
const
username
=
"some-user"
;
let
user_id
:
string
;
async
function
setup
(
app
:
App
)
{
user_id
=
(
await
app
.
collections
.
users
.
suCreate
({
username
,
password
,
})
).
id
;
}
it
(
"Hides password"
,
async
()
=>
withRunningApp
(
null
,
async
({
app
,
rest_api
})
=>
{
await
setup
(
app
);
const
session
=
await
rest_api
.
login
({
username
,
password
,
});
assert
.
ok
(
!
(
await
rest_api
.
get
(
`/api/v1/collections/users/
${
user_id
}
`
,
session
)
).
password
);
assert
.
equal
(
(
await
app
.
collections
.
users
.
suGetByID
(
user_id
)).
get
(
"password"
),
"secret"
);
}));
it
(
"Stores correct password value"
,
async
()
=>
withRunningApp
(
null
,
async
({
app
})
=>
{
await
setup
(
app
);
const
hashed_password
=
(
await
app
.
Datastore
.
find
(
"users"
,
{
id
:
user_id
,
})
)[
0
].
password
as
string
;
assert
.
ok
(
await
SecureHasher
.
matches
(
password
,
hashed_password
));
assert
.
ok
(
!
(
await
SecureHasher
.
matches
(
"wrong-password"
,
hashed_password
))
);
assert
.
ok
(
!
(
await
SecureHasher
.
matches
(
""
,
hashed_password
)));
}));
});
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Mon, Jul 21, 00:22 (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
802875
Default Alt Text
password.subtest.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment