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

How to adjust password reset link? #1342

Closed
dron247 opened this issue Apr 3, 2016 · 7 comments
Closed

How to adjust password reset link? #1342

dron247 opened this issue Apr 3, 2016 · 7 comments

Comments

@dron247
Copy link

dron247 commented Apr 3, 2016

Hello guys my password reset email looks like

Hi,

You requested to reset your password for Appname body tracker.

Click here to reset it:
http://backend.appname.com/apps/appname-backend/request_password_reset?token=cUGfvWPqttbAMuc7WLB64tvvj&username=appuser


But, those link is completely wrong and this part: "apps/appname-backend/" is redundant and i have to remove it, is it possible? or its better to just reroute it in index.js?

like that

app.get('/', function(req, res) {
  res.redirect('http://appname.com');
});

also question, how to redirect with parameters preservation?

Thanks.

@djarunn
Copy link

djarunn commented Apr 3, 2016

The problem is with the "publicServerURL" you supply in the index.js file.
No need to reroute the requests.
Can you tell me your publicServerURL if incase you are unable to fix.

@dron247
Copy link
Author

dron247 commented Apr 3, 2016

@djarunn here is my index.js

// Example express application adding the parse-server module to expose Parse
// compatible API routes.

var express = require('express');
var ParseServer = require('parse-server').ParseServer;

var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI;

if (!databaseUri) {
  console.log('DATABASE_URI not specified, falling back to localhost.');
}
//comment for deploy
var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL || 'http://localhost:1337',  // Don't forget to change to https if needed

  /*emailAdapter: SimpleMailgunAdapter({
    apiKey: process.env.MAILGUN_API_KEY,
    domain: process.env.MAILGUN_DOMAIN,
    fromAddress: process.env.MAIL_FROM_ADDRESS
  })*/

  // The public URL of your app.
  // This will appear in the link that is used to verify email addresses and reset passwords.
  publicServerURL: 'http://backend.appname.com',
  // Your apps name. This will appear in the subject and body of the emails that are sent.
  appName: 'appname blah blah',

  emailAdapter: {
    module: 'parse-server-simple-mailgun-adapter',
    options: {
      // The address that your emails come from
      fromAddress: process.env.MAIL_FROM_ADDRESS,
      // Your domain from mailgun.com
      domain: process.env.MAILGUN_DOMAIN,
      // Your API key from mailgun.com
      apiKey: process.env.MAILGUN_API_KEY,
    }
  }
  /*customPages: {
    invalidLink: 'http://yourdomain.com/invalid_link.html',
    verifyEmailSuccess: 'http://yourdomain.com/verify_email_success.html',
    choosePassword: 'http://yourdomain.com/choose_password.html',
    passwordResetSuccess: 'http://yourdomain.com/password_reset_success.html'
  }*/
});
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
// If you wish you require them, you can set them as options in the initialization above:
// javascriptKey, restAPIKey, dotNetKey, clientKey

var app = express();

// Serve the Parse API on the /parse URL prefix
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);

// Parse Server plays nicely with the rest of your web routes
app.get('/', function(req, res) {
  //res.status(200).send('Welcome to appname, landing page will be here someday');
  res.redirect('http://appname.com');
});

var port = process.env.PORT || 1337;
app.listen(port, function() {
    console.log('parse-server-appname running on port ' + port + '.');
});

@djarunn
Copy link

djarunn commented Apr 3, 2016

try changing your

publicServerURL: 'http://backend.appname.com'

to

publicServerURL: 'http://backend.appname.com/parse'
On 03-Apr-2016 6:22 pm, "dron247" notifications@github.com wrote:

@djarunn https://github.com/djarunn here is my index.js

// Example express application adding the parse-server module to expose Parse
// compatible API routes.

var express = require('express');
var ParseServer = require('parse-server').ParseServer;

var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI;

if (!databaseUri) {
console.log('DATABASE_URI not specified, falling back to localhost.');
}
//comment for deploy
var api = new ParseServer({
databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
appId: process.env.APP_ID || 'myAppId',
masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
serverURL: process.env.SERVER_URL || 'http://localhost:1337', // Don't forget to change to https if needed

/emailAdapter: SimpleMailgunAdapter({
apiKey: process.env.MAILGUN_API_KEY,
domain: process.env.MAILGUN_DOMAIN,
fromAddress: process.env.MAIL_FROM_ADDRESS
})
/

// The public URL of your app.
// This will appear in the link that is used to verify email addresses and reset passwords.
publicServerURL: 'http://backend.appname.com',
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: 'appname blah blah',

emailAdapter: {
module: 'parse-server-simple-mailgun-adapter',
options: {
// The address that your emails come from
fromAddress: process.env.MAIL_FROM_ADDRESS,
// Your domain from mailgun.com
domain: process.env.MAILGUN_DOMAIN,
// Your API key from mailgun.com
apiKey: process.env.MAILGUN_API_KEY,
}
}
/customPages: {
invalidLink: 'http://yourdomain.com/invalid_link.html',
verifyEmailSuccess: 'http://yourdomain.com/verify_email_success.html',
choosePassword: 'http://yourdomain.com/choose_password.html',
passwordResetSuccess: 'http://yourdomain.com/password_reset_success.html'
}
/
});
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
// If you wish you require them, you can set them as options in the initialization above:
// javascriptKey, restAPIKey, dotNetKey, clientKey

var app = express();

// Serve the Parse API on the /parse URL prefix
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);

// Parse Server plays nicely with the rest of your web routes
app.get('/', function(req, res) {
//res.status(200).send('Welcome to appname, landing page will be here someday');
res.redirect('http://appname.com');
});

var port = process.env.PORT || 1337;
app.listen(port, function() {
console.log('parse-server-appname running on port ' + port + '.');
});


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#1342 (comment)

@flovilmart
Copy link
Contributor

But, those link is completely wrong and this part: "apps/appname-backend/" is redundant and i have to remove it

what do you mean by that?

@dron247
Copy link
Author

dron247 commented Apr 4, 2016

@djarunn yes it worked, thanks a lot!
Reset url is bit ugly
http://**backend.appname**.com/parse/apps/**appname-backend**/request_password_reset?token=ZqGZ02HyFNlyLHGuqj1o5AvZg&username=appuser
but anyway it doesn't matter

@dron247 dron247 closed this as completed Apr 4, 2016
@agordeev
Copy link

I think this should be included into the documentation/wiki.

@w3care25
Copy link

I am getting following error when trying to requestPasswordReset.
My Parse server version is : 1.0.0
{"level":"error","message":"Uncaught internal server error. [TypeError: promiseHandler(...).then is not a function] TypeError: promiseHandler(...).then is not a function\n at parse/node_modules/parse-server/lib/PromiseRouter.js:286:27\n

also email is not going.

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

5 participants