diff --git a/lib/auth.js b/lib/auth.js index 2e6931c..dc5729a 100644 --- a/lib/auth.js +++ b/lib/auth.js @@ -9,7 +9,7 @@ var getCSRFToken = require('./csrf-token'); // We don't want to wait until the token is already expired before refreshing it. var BEARER_TOKEN_EXPIRATION_ALLOWANCE = 60 * 1000; -module.exports = new Model({ +const authClient = new Model({ _currentUserPromise: null, _bearerToken: '', @@ -358,3 +358,18 @@ module.exports = new Model({ }.bind(this)); }, }); + +module.exports = { + changePassword: authClient.changePassword.bind(authClient), + checkCurrent: authClient.checkCurrent.bind(authClient), + checkBearerToken: authClient.checkBearerToken.bind(authClient), + disableAccount: authClient.disableAccount.bind(authClient), + listen: authClient.listen.bind(authClient), + register: authClient.register.bind(authClient), + requestPasswordReset: authClient.requestPasswordReset.bind(authClient), + resetPassword: authClient.resetPassword.bind(authClient), + signIn: authClient.signIn.bind(authClient), + stopListening: authClient.stopListening.bind(authClient), + signOut: authClient.signOut.bind(authClient), + unsubscribeEmail: authClient.unsubscribeEmail.bind(authClient) +}; diff --git a/lib/oauth.js b/lib/oauth.js index 19eeec4..2ef7f3f 100644 --- a/lib/oauth.js +++ b/lib/oauth.js @@ -17,7 +17,7 @@ var LOCAL_STORAGE_PREFIX = 'panoptesClientOAuth_'; var SESSION_STORAGE = window.localStorage; // Create our model, then do stuff with it later -module.exports = new Model({ +const authClient = new Model({ _bearerRefreshTimeout: NaN, _clientAppId: ls.get(LOCAL_STORAGE_PREFIX + 'clientAppId'), _currentSessionCheckPromise: null, @@ -312,3 +312,13 @@ function destroyIFrame(iframe) { iframe.parentNode.removeChild(iframe); return null; } + +module.exports = { + checkCurrent: authClient.checkCurrent.bind(authClient), + checkBearerToken: authClient.checkBearerToken.bind(authClient), + init: authClient.init.bind(authClient), + listen: authClient.listen.bind(authClient), + stopListening: authClient.stopListening.bind(authClient), + signIn: authClient.signIn.bind(authClient), + signOut: authClient.signOut.bind(authClient) +}