mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-17 11:35:33 -04:00
(auth)(bug) fix account switch validation might randomly switch to other authenticated account
This commit is contained in:
parent
990e8a8b0d
commit
a37623f838
@ -59,7 +59,7 @@ export default {
|
||||
async validateAccounts() {
|
||||
for (let [username, {token}] of Object.entries(this.accounts)) {
|
||||
try {
|
||||
const user = await this.$axios.$get(`/user/current`, {
|
||||
const user = await this.$axios.$get(`/user/current?no_cookie`, {
|
||||
headers: {
|
||||
authorization: 'Bearer ' + token,
|
||||
},
|
||||
|
@ -298,7 +298,9 @@ router.use(handleErrorAsync(reloadUser));
|
||||
|
||||
export const loadCurrentUser = async (req, res) => {
|
||||
if (!req.user) {
|
||||
res.clearCookie('token');
|
||||
if (req.query.no_cookie === undefined) {
|
||||
res.clearCookie('token');
|
||||
}
|
||||
return res.json(null);
|
||||
}
|
||||
|
||||
@ -312,7 +314,9 @@ export const loadCurrentUser = async (req, res) => {
|
||||
delete dbUser.timesheets;
|
||||
|
||||
const token = await issueAuthentication(req.db, dbUser, false);
|
||||
res.cookie('token', token, cookieSettings);
|
||||
if (req.query.no_cookie === undefined) {
|
||||
res.cookie('token', token, cookieSettings);
|
||||
}
|
||||
req.rawUser = jwt.validate(token);
|
||||
req.user = req.rawUser;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user