Skip to content

Commit

Permalink
Merge pull request #1261 from sharetribe/fix-limited-access-banner
Browse files Browse the repository at this point in the history
Add a null check for authScopes variable
  • Loading branch information
lyyder committed Feb 18, 2020
2 parents 606cec3 + bc02fe0 commit 76ba4d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ way to update this template, but currently, we follow a pattern:

- [add] Show a banner when a user is logged in with limited access.
[#1259](https://github.com/sharetribe/ftw-daily/pull/1259)
[#1261](https://github.com/sharetribe/ftw-daily/pull/1261)
- [add] Support for logging in as a user from Console.
[#1254](https://github.com/sharetribe/ftw-daily/pull/1254)
- [change] Add `handlebars` 4.5.3 and `serialize-javascript` 2.1.1 to resolutions in `package.json`.
Expand Down
12 changes: 6 additions & 6 deletions server/apiRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* tasks that can not be handled in the browser.
*
* The endpoints should not clash with the application routes. Therefore, the
* enpoints are prefixed in the main server where this file is used.
* endpoints are prefixed in the main server where this file is used.
*/

const http = require('http');
Expand All @@ -23,8 +23,8 @@ const USING_SSL = process.env.REACT_APP_SHARETRIBE_USING_SSL === 'true';

const router = express.Router();

// redirect_uri param used when initiating a login as authenitcation flow and
// when requesting a token useing an authorization code
// redirect_uri param used when initiating a login as authentication flow and
// when requesting a token using an authorization code
const loginAsRedirectUri = `${ROOT_URL.replace(/\/$/, '')}/api/login-as`;

// Instantiate HTTP(S) Agents with keepAlive set to true.
Expand All @@ -50,14 +50,14 @@ const urlifyBase64 = base64Str =>

// Initiates an authorization code authentication flow. This authentication flow
// enables marketplace operators that have an ongoing Console session to log
// into their marketplace as a user of the marketpalce.
// into their marketplace as a user of the marketplace.
//
// The authroization code is requested from Console and it is used to request a
// The authorization code is requested from Console and it is used to request a
// token from the Flex Auth API.
//
// This endpoint will return a 302 to Console which requests the authorization
// code. Console returns a 302 with the code to the `redirect_uri` that is
// passed in this reponse. The request to the redirect URI is handled with the
// passed in this response. The request to the redirect URI is handled with the
// `/login-as` endpoint.
router.get('/initiate-login-as', (req, res) => {
const userId = req.query.user_id;
Expand Down
1 change: 1 addition & 0 deletions src/components/LimitedAccessBanner/LimitedAccessBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const LimitedAccessBanner = props => {
const showBanner =
user.id &&
isAuthenticated &&
authScopes &&
authScopes.length === 1 &&
authScopes[0] === 'user:limited' &&
!disabledPages.includes(currentPage);
Expand Down

0 comments on commit 76ba4d8

Please sign in to comment.