Changeset View
Changeset View
Standalone View
Standalone View
lib/app/base-chips/field-types/password.subtest.js
Show All 27 Lines | with_running_app(async ({ app, rest_api, base_url }) => { | ||||
username, | username, | ||||
password, | password, | ||||
}); | }); | ||||
assert.ok( | assert.ok( | ||||
!(await rest_api.get( | !(await rest_api.get( | ||||
`/api/v1/collections/users/${user_id}`, | `/api/v1/collections/users/${user_id}`, | ||||
session | session | ||||
)).body.password | )).password | ||||
); | ); | ||||
assert.ok( | assert.ok( | ||||
!(await app.run_action( | !(await app.run_action( | ||||
new app.Sealious.SuperContext(), | new app.Sealious.SuperContext(), | ||||
["collections", "users", user_id], | ["collections", "users", user_id], | ||||
"show" | "show" | ||||
)).body.password | )).password | ||||
); | ); | ||||
})); | })); | ||||
it("Stores correct password value", async () => | it("Stores correct password value", async () => | ||||
with_running_app(async ({ app, rest_api, base_url }) => { | with_running_app(async ({ app, rest_api, base_url }) => { | ||||
await setup(app, rest_api, base_url); | await setup(app, rest_api, base_url); | ||||
const hashed_password = (await app.Datastore.find("users", { | const hashed_password = (await app.Datastore.find("users", { | ||||
sealious_id: user_id, | sealious_id: user_id, | ||||
}))[0].body.password; | }))[0].password; | ||||
assert.ok(await SecureHasher.matches(password, hashed_password)); | assert.ok(await SecureHasher.matches(password, hashed_password)); | ||||
assert.ok( | assert.ok( | ||||
!(await SecureHasher.matches("wrong-password", hashed_password)) | !(await SecureHasher.matches("wrong-password", hashed_password)) | ||||
); | ); | ||||
assert.ok(!(await SecureHasher.matches("", hashed_password))); | assert.ok(!(await SecureHasher.matches("", hashed_password))); | ||||
})); | })); | ||||
}); | }); |