2017-04-10 51 views
0

我激活「忘記密碼?」功能。在流星。我在我的收件箱裏收到一封來自流星的電子郵件,重置密碼,一切都很好,但問題出在生成的鏈接上,因爲我在鏈接中獲得了#。 (見中的鏈接)流星通過使用「忘記密碼」功能發送錯誤生成的鏈接(#)

http://localhost:3000/#/reset-password/8DhEtotkn0A0EU- 
kShhmB6llHlfXpXCXAIqNYvrsZzi 

當我從上面的鏈接刪除#和copypaste在瀏覽器中的鏈接,然後它的正常工作。

哪裏來#在鏈接?以及如何在我的流星項目中將其刪除以正確鏈接到其他密碼?需要

的幫助,感謝

+0

這是由'賬戶,base'默認生成的鏈接。它是由'accounts-client'挑選的,並且調用你可能已經用'Accounts.onResetPasswordLink()'註冊過的任何回調。你是如何設置重置處理過程的? – MasterAM

+0

我使用了https://www.mailgun.com/。我只添加了這個 process.env.MAIL_URL =「smtp://postmaster%40sandbox202f4c3b9d397531e92b47ef.mailgun.org:[email protected]:587/」; – AhmyOhlin

+0

如何獲得設置accounts.onResetPasswordLink()? 我可以在哪裏找到令牌? – AhmyOhlin

回答

0

您可以使用Accounts.urls.resetPassword功能

在你server/main.js文件中插入下面的代碼更改此:

Meteor.startup(function() { 
    Accounts.urls.resetPassword = function(token) { 
     return Meteor.absoluteUrl('reset-password/' + token); 
    }; 
}); 

你可以設置你想上面的任何URL。

你也可以添加更多的信息來定製的電子郵件,如果你想:

Meteor.startup(function() { 
    Accounts.urls.resetPassword = function(token) { 
     return Meteor.absoluteUrl('reset-password/' + token); 
    }; 
    Accounts.emailTemplates.siteName = "Your Application Name"; 
    Accounts.emailTemplates.from = "Application Name <[email protected]>"; 
}); 
+0

感謝您的答案我添加上面的基本代碼在server/main.js但我仍然得到一個生成的代碼與哈希http://本地主機:3000 /#/重置密碼/ 0dBUFCho9gQI0P43Cmvg - zFdF1U2LI2YjA2IM9dCd9J – AhmyOhlin

+0

沒有問題,它工作爲你?如果這樣你能接受它作爲答案嗎?謝謝! – Sean

+0

不,它仍然不起作用。當我點擊在我的收件箱中生成的鏈接時,我在我的瀏覽器中得到http:// localhost:3000#其餘的將被刪除 – AhmyOhlin