Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test for missing authentication token #5450

Merged
merged 8 commits into from
Feb 17, 2023
Prev Previous commit
Next Next commit
Fix missing auth token after registration when email verification isn…
…'t required
  • Loading branch information
Marishka17 committed Dec 14, 2022
commit f4aabbd429c0648132ce0297b4d3d9536d16a123
12 changes: 12 additions & 0 deletions cvat-core/src/server-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,18 @@ async function register(username, firstName, lastName, email, password, confirma
'Content-Type': 'application/json',
},
});
if (response.headers['set-cookie']) {
// Browser itself setup cookie and header is none
// In NodeJS we need do it manually
const cookies = response.headers['set-cookie'].join(';');
Axios.defaults.headers.common.Cookie = cookies;
}
// if email verification isn't required
if (response.data.key) {
token = response.data.key;
store.set('token', token);
Axios.defaults.headers.common.Authorization = `Token ${token}`;
}
klakhov marked this conversation as resolved.
Show resolved Hide resolved
} catch (errorData) {
throw generateError(errorData);
}
Expand Down