Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement Parse Frame URL #3090

Closed
lenart opened this issue Nov 21, 2016 · 6 comments
Closed

Reimplement Parse Frame URL #3090

lenart opened this issue Nov 21, 2016 · 6 comments

Comments

@lenart
Copy link
Contributor

lenart commented Nov 21, 2016

There is no easy way to reimplement what was known as "Parse Frame URL" that was used to mask Parse.com URLs on user-facing pages.

This URL was used for displaying pages dealing with password reset (and email confirmation which we're not using). Because the current setup already works (with parse.com) we'd like to keep the same functionality since we already solved the styling issues on the destination page that displays content within an IFRAME.

The link itself is constructed in parse-server/lib/Controllers/UserController.js:185 but I'm not sure how I could prepend the Frame URL and send the link as params. Something like:

var link = _this3.config.parseFrameURL + '?link=' + _this3.config.requestResetPasswordURL + 'token=' + token + '&username=' + username;
@lenart
Copy link
Contributor Author

lenart commented Nov 21, 2016

Here's a quick (but hacky) implementation of what I was talking about:

Add config to self-hosted parse

// self-hosted parse server's index.js
var api = new ParseServer({
  ...,
  customPages: {
    parseFrameURL: "http://myserver.com/handle-parse-iframe",
    invalidLink: "http://localhost:1337/public/invalid_link.html",
  }
  ...

Changes needed in parse-server.

  // parse-server/lib/Controllers/UserController.js
  // call to setPasswordResetToken() around line 182

        if (_this3.config.parseFrameURL) {
          var strippedResetLink = _this3.config.requestResetPasswordURL.replace(_this3.config.publicServerURL, '');
          var link = _this3.config.parseFrameURL + '?link=' + encodeURIComponent(strippedResetLink) + '&token=' + token + '&username=' + username;
        } else {
          var link = _this3.config.requestResetPasswordURL + '?token=' + token + '&username=' + username;
        }

Is there a way to achieve this without changing parse-server module directly?

@flovilmart
Copy link
Contributor

did you try setting publicServerURL ?

@lenart
Copy link
Contributor Author

lenart commented Nov 21, 2016

To be honest it just feels like an important variable which I didn't want to change because I need a single functionality slightly modified. I still want the server to be used/accessible on my-parse-server.com but to send password reset links pointing to different domain (eg. my-website.com). I'll see if changing publicServerURL could do the trick.

@flovilmart
Copy link
Contributor

ok in your case you want different domains for your links right? I belive this is a valid feature request.
Can you make a PR for it?

@lenart
Copy link
Contributor Author

lenart commented Nov 21, 2016

I'll prepare a PR with the code above but keep in mind I'm not a node ninja ;)

@lenart lenart closed this as completed Nov 21, 2016
@flovilmart
Copy link
Contributor

No need to be a ninja! You identified the issue and have a workaround :) I'll help you along the way with the PR open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants