Skip to content

Commit 4a6c854

Browse files
author
Curtis Lacy
committed
Parse out the location properly before we kick off an authentication flow, so that we can come back where we started.
1 parent 00a801c commit 4a6c854

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

app/app-js/modules/menu/menuPanel/menuPanel.view.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ define(function (require) {
4848
if (this.model.get('connected')) {
4949
window.location.assign('/disconnect/' + this.model.get('serviceKey'));
5050
} else {
51-
window.location.assign('/auth/' + this.model.get('serviceKey') + '?auth-return=%2F%23tryUri%2Ffacebook%2Fuserprofile');
51+
window.location.assign('/auth/' + this.model.get('serviceKey') + '?auth-return=' + encodeURIComponent( window.location.pathname + window.location.hash ));
5252
}
5353
},
5454

server.js

-4
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ app.get( '/auth/imap',
186186
app.get( '/auth/facebook/callback',
187187
passport.authenticate( 'facebook', { failureRedirect: '#auth-failure' } ),
188188
function( req, res ) {
189-
console.log( 'About to do redirect!' );
190189
if( req.session[ 'auth-return' ] )
191190
res.redirect( req.session[ 'auth-return' ]);
192191
else
@@ -197,7 +196,6 @@ app.get( '/auth/facebook/callback',
197196
app.get( '/auth/twitter/callback',
198197
passport.authenticate( 'twitter', { failureRedirect: '#auth-failure' } ),
199198
function( req, res ) {
200-
console.log( 'About to do redirect!' );
201199
if( req.session[ 'auth-return' ] )
202200
res.redirect( req.session[ 'auth-return' ]);
203201
else
@@ -208,7 +206,6 @@ app.get( '/auth/twitter/callback',
208206
app.get( '/auth/imap/callback',
209207
passport.authenticate( 'imap', { failureRedirect: '#auth-failure' } ),
210208
function( req, res ) {
211-
console.log( 'About to do redirect!' );
212209
if( req.session[ 'auth-return' ] )
213210
res.redirect( req.session[ 'auth-return' ]);
214211
else
@@ -219,7 +216,6 @@ app.get( '/auth/imap/callback',
219216
app.get( '/auth/gmail/callback',
220217
passport.authenticate( 'gmail', { failureRedirect: '#auth-failure' } ),
221218
function( req, res ) {
222-
console.log( 'About to do redirect!' );
223219
if( req.session[ 'auth-return' ] )
224220
res.redirect( req.session[ 'auth-return' ]);
225221
else

0 commit comments

Comments
 (0)