feat(auth): remember password securely
This commit is contained in:
@@ -80,11 +80,16 @@ describe('auth store', () => {
|
||||
await useAuthStore.getState().loginWithPassword({
|
||||
username: 'zhangsan',
|
||||
password: 'secret',
|
||||
rememberPassword: true,
|
||||
});
|
||||
|
||||
expect(hostApiFetchMock).toHaveBeenNthCalledWith(1, '/api/auth/login', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ username: 'zhangsan', password: 'secret' }),
|
||||
body: JSON.stringify({
|
||||
username: 'zhangsan',
|
||||
password: 'secret',
|
||||
rememberPassword: true,
|
||||
}),
|
||||
});
|
||||
expect(hostApiFetchMock).toHaveBeenNthCalledWith(2, '/api/auth/me');
|
||||
expect(hostApiFetchMock).not.toHaveBeenCalledWith(
|
||||
@@ -114,6 +119,7 @@ describe('auth store', () => {
|
||||
expect(window.localStorage.getItem('niancode-auth')).not.toContain(
|
||||
'must-not-return-to-renderer-storage',
|
||||
);
|
||||
expect(window.localStorage.getItem('niancode-auth')).not.toContain('secret');
|
||||
});
|
||||
|
||||
it('logs in with a mobile code using only the phone and code payload', async () => {
|
||||
|
||||
Reference in New Issue
Block a user