diff --git a/lib/passport-cas.js b/lib/passport-cas.js index 52f1c33..540c34d 100644 --- a/lib/passport-cas.js +++ b/lib/passport-cas.js @@ -168,7 +168,8 @@ CasStrategy.prototype.authenticate = function(req, options) { if (!ticket) { // Redirect to CAS server for authentication - self.redirect(self.casBaseUrl + '/login?service=' + encodeURIComponent(service), 307); + var date = new Date(Date.now()); + self.redirect(`${self.casBaseUrl}/login?service=${encodeURIComponent(`${service}/?_cas_retry=${Math.round(date.getTime() / 60000)}`)}`, 307); } else { // User has returned from CAS site with a ticket @@ -176,7 +177,7 @@ CasStrategy.prototype.authenticate = function(req, options) { // Ticket validation failed if (err) { - var date = new Date(); + var date = new Date(Date.now()); var token = Math.round(date.getTime() / 60000); if (req.query['_cas_retry'] != token) { // There was a CAS error. A common cause is when an old