-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
165 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ password attempt.`, | |
email: { | ||
description: 'The email to try in this attempt, e.g. "[email protected]".', | ||
type: 'string', | ||
isEmail: true, | ||
required: true | ||
}, | ||
|
||
|
@@ -39,6 +40,9 @@ that, thanks to the included "custom" hook, when a relevant request is received | |
from a logged-in user, that user's entire record from the database will be fetched | ||
and exposed as a shared data via loggedInUser prop.)`, | ||
responseType: 'redirect' | ||
}, | ||
badCombo: { | ||
responseType: 'badRequest' | ||
} | ||
}, | ||
|
||
|
@@ -48,12 +52,23 @@ and exposed as a shared data via loggedInUser prop.)`, | |
}) | ||
|
||
if (!user) { | ||
throw 'badCombo' | ||
throw { | ||
badCombo: { | ||
problems: [{ login: 'Wrong email/password.' }] | ||
} | ||
} | ||
} | ||
|
||
await sails.helpers.passwords | ||
.checkPassword(password, user.password) | ||
.intercept('incorrect', 'badCombo') | ||
try { | ||
await sails.helpers.passwords.checkPassword(password, user.password) | ||
} catch (e) { | ||
sails.log.error(e.message) | ||
throw { | ||
badCombo: { | ||
problems: [{ login: 'Wrong email/password.' }] | ||
} | ||
} | ||
} | ||
|
||
if (rememberMe) { | ||
this.req.session.cookie.maxAge = | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.