mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
🎨 validate ghost profile/token response (#7761)
no issue - check if profile or access token exists when receiving the response from Ghost Auth server
This commit is contained in:
parent
89d40133a0
commit
eebdfab7b0
1 changed files with 7 additions and 2 deletions
|
@ -69,14 +69,19 @@ strategies = {
|
||||||
* - via invite token
|
* - via invite token
|
||||||
* - via normal auth
|
* - via normal auth
|
||||||
* - via setup
|
* - via setup
|
||||||
*
|
|
||||||
* @TODO: validate GhostAuth profile?
|
|
||||||
*/
|
*/
|
||||||
ghostStrategy: function ghostStrategy(req, ghostAuthAccessToken, ghostAuthRefreshToken, profile, done) {
|
ghostStrategy: function ghostStrategy(req, ghostAuthAccessToken, ghostAuthRefreshToken, profile, done) {
|
||||||
var inviteToken = req.body.inviteToken,
|
var inviteToken = req.body.inviteToken,
|
||||||
options = {context: {internal: true}},
|
options = {context: {internal: true}},
|
||||||
handleInviteToken, handleSetup;
|
handleInviteToken, handleSetup;
|
||||||
|
|
||||||
|
// CASE: socket hangs up for example
|
||||||
|
if (!ghostAuthAccessToken || !profile) {
|
||||||
|
return done(new errors.NoPermissionError({
|
||||||
|
help: 'Please try again.'
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
handleInviteToken = function handleInviteToken() {
|
handleInviteToken = function handleInviteToken() {
|
||||||
var user, invite;
|
var user, invite;
|
||||||
inviteToken = utils.decodeBase64URLsafe(inviteToken);
|
inviteToken = utils.decodeBase64URLsafe(inviteToken);
|
||||||
|
|
Loading…
Add table
Reference in a new issue