Skip to content

Commit

Permalink
Merge branch 'devel' of https://github.com/VulcanJS/Vulcan into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
SachaG committed Oct 7, 2020
2 parents 695d499 + b0ca4a2 commit 78d0e99
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 28 deletions.
24 changes: 3 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions packages/vulcan-accounts/imports/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ try {
}
export const loginButtonsSession = Accounts._loginButtonsSession;
export const STATES = {
SIGN_IN: Symbol('SIGN_IN'),
SIGN_UP: Symbol('SIGN_UP'),
PROFILE: Symbol('PROFILE'),
PASSWORD_CHANGE: Symbol('PASSWORD_CHANGE'),
PASSWORD_RESET: Symbol('PASSWORD_RESET'),
ENROLL_ACCOUNT: Symbol('ENROLL_ACCOUNT')
SIGN_IN: Symbol.for('SIGN_IN'),
SIGN_UP: Symbol.for('SIGN_UP'),
PROFILE: Symbol.for('PROFILE'),
PASSWORD_CHANGE: Symbol.for('PASSWORD_CHANGE'),
PASSWORD_RESET: Symbol.for('PASSWORD_RESET'),
ENROLL_ACCOUNT: Symbol.for('ENROLL_ACCOUNT')
};

export function getLoginServices() {
Expand Down
14 changes: 13 additions & 1 deletion packages/vulcan-users/lib/server/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,25 @@ const specificResolvers = {
if (!email) {
throw new Error('Invalid email');
}
return await authenticateWithPassword(email, password);
const authResult = await authenticateWithPassword(email, password);
// set an HTTP-only cookie so the user is authenticated
const { /*userId,*/ token } = authResult;
const tokenCookie = {
path: '/',
httpOnly: true,
secure: process.env.NODE_ENV === 'development' ? false : true,
// expires: //
//sameSite: ''
};
context.req.res.cookie('meteor_login_token', token, tokenCookie);
return authResult;
},
async logout(root, args, context) {
if (!(context && context.userId)) {
throw new Error('User already logged out');
}
const { userId } = context;
context.req.res.clearCookie('meteor_login_token');
return await logout(userId);
},
async signup(root, args, context) {
Expand Down

0 comments on commit 78d0e99

Please sign in to comment.