我对如何使用Accounts.onEmailVerificationLink.
文档有点模棱两可:
Accounts.onEmailVerificationLink(回调)
注册一个函数,当单击 Accounts.sendVerificationEmail 发送的电子邮件中的电子邮件验证链接时调用。这个函数 应该在顶级代码中调用,而不是在 Meteor.startup() 中。
“这个函数”、回调函数或Accounts.onEmailVerificationLink它本身究竟是什么意思?
无论如何,无论我把东西放在哪里,我总是在浏览器控制台上收到此错误消息:
Accounts.onEmailVerificationLink was called more than once. Only one callback added will be executed.
Run Code Online (Sandbox Code Playgroud) 在方法中调用时,似乎"Meteor.loginWithPassword"函数不起作用.
我想用autoforms创建我的登录表单,所以我创建了一个回调方法,在用户提交登录表单后调用该方法.表单被称为正确的方式,但loginWithPassword函数似乎不起作用.
这是我的方法(在客户端和服务器端)
Meteor.methods({
autoform_test_login : function (doc) {
console.log('Called login method');
if (Meteor.isClient) {
Meteor.loginWithPassword('test', 'test', function(e) {
if (e) {
console.log(e);
}
});
}
}
});
Run Code Online (Sandbox Code Playgroud)
提交时,我的autoforms调用此方法:
{{#autoForm schema="Schema_Login" id="form_login" type="method" meteormethod="autoform_test_login"}}
....
Run Code Online (Sandbox Code Playgroud)
提交此表单时,我收到此错误:
Error: No result from call to login {stack: (...), message: "No result from call to login"}
Run Code Online (Sandbox Code Playgroud)
当我现在打开浏览器控制台并键入:
Meteor.call('autoform_test_login');
Run Code Online (Sandbox Code Playgroud)
我会得到同样的错误.
但是:当我在我的控制台中输入以下内容时它可以工作(现在的错误是:找不到用户名):
Meteor.loginWithPassword('test', 'test', function(e) {
if (e) {
console.log(e);
}
});
Run Code Online (Sandbox Code Playgroud)
我的方法绝对没有别的,然后这个剪断,所以我问自己这里出了什么问题.
Ps.:我知道我将"test"添加为Username,将"test"添加为密码 - 仅用于测试.即使输入正确,错误总是相同的.
我有一个模板,我试图显示所谓的userList中的所有用户.
//服务器
Meteor.publish("userList", function() {
var user = Meteor.users.findOne({
_id: this.userId
});
if (Roles.userIsInRole(user, ["admin"])) {
return Meteor.users.find({}, {
fields: {
profile_name: 1,
emails: 1,
roles: 1
}
});
}
this.stop();
return;
});
Run Code Online (Sandbox Code Playgroud)
在此先感谢您的帮助!
我有一个Meteor应用程序使用该useraccounts:core程序包为用户,我自己的Mailgun帐户配置MAIL_URL; 我还配置了from地址"MYNAME <me@domain.com>".
当用户注册时,会发送一封验证邮件.问题是,当用户点击"回复"时,它回复他们的地址而不是我的地址.
我不知道问题可能是什么,或者它是否与Meteor,Mailgun或Gmail有关.
关于Gmail:我在不同平台上查看完全相同的电子邮件,并且回复按预期工作(转到正确的地址).
我尝试过的:
from地址时,它将恢复为默认的流星电子邮件(no-reply@meteor.com),并且回复按预期工作Email.send(to, from, etc.),回复按预期工作replyTo标题 - Accounts.emailTemplates.headers = {replyTo : "test@killer.football"}- 没有效果有了这一切,我仍然无法确定问题发生的位置.看起来它只限于gmail,但仅限于某些情况下(from设置在哪里).任何帮助非常感谢.
最后,这可能是Meteor Mailgun对电子邮件没有"来自"地址的回复的重复,但我发布的是一个单独的问题,因为那里的信息不足以确定,并且他们没有尝试过这些东西我试过了.
我正在尝试使用 Meteor 的帐户密码包进行电子邮件验证以与 React/Meteor 一起使用。我正在使用 React 路由器。我不确定该放在哪里/如何称呼它:
Accounts.onEmailVerificationLink(function(token, done) {
Accounts.verifyEmail(token);
});
Run Code Online (Sandbox Code Playgroud)
我有一个注册组件和容器,我正在尝试获取验证电子邮件以链接到登录组件/容器并进行验证。我在 Meteor.(isServer) Meteor.startup 块中完成了以下操作:
Accounts.urls.verifyEmail = function(){
return Meteor.absoluteUrl("restaurantsignin");
};
Run Code Online (Sandbox Code Playgroud)
我的反应路由器文件如下所示:
Meteor.startup(() => {
render(
<Router history={browserHistory}>
<Route path="/" component={App}>
<IndexRoute component={Home} />
<Route path="/about" component={About} />
<Route path="/restaurantsignin" component={RestaurantSignInContainer} />
<Route path="/restaurantsignup" component={RestaurantSignUpContainer} />
<Route path="/customersignup" component={CustomerSignUpContainer} />
<Route path="/restaurantresetemail" component={RestaurantResetEmailContainer} />
<Route path="/restaurantresetpassword" component={RestaurantResetPasswordContainer} />
<Route path="/restaurant/:restaurantName" component={MenuPage} />
</Route>
</Router>, document.getElementById('app')
);
});
Run Code Online (Sandbox Code Playgroud)
我的反应组件文件如下所示:
import React from 'react';
import Radium from 'radium';
import ReactDOM from …Run Code Online (Sandbox Code Playgroud) 我正在设置 Meteor 应用程序并首次使用 Google 登录。这在应用程序的网络应用程序版本中运行良好。但是,在为 iOS 构建应用程序时,这会产生问题。
我这样做:
流星运行 ios-device --mobile-server https://myapp.meteorapp.com
然后得到这个:
无法安装“cordova-plugin-googleplus”:错误:缺少变量:REVERSED_CLIENT_ID
和
在将插件https://github.com/meteor/cordova-plugin-googleplus.git#blabla添加到 Cordova 项目时:错误:缺少变量:REVERSED_CLIENT_ID
如何解决这个问题?
我有一个Meteor应用程序,它允许用户通过meteor的accounts-facebook包注册facebook oauth .我已经设置了所有必要的软件包和UI,并使用mLab数据库(沙箱)在Heroku(免费计划)上部署了应用程序.我已经设置了Facebook应用程序和身份验证,登录对我来说很好.我已成功通过我的Facebook多次在应用程序上注册.
然而,当我住在香港的一位开发人员(我在印度)试图做同样的事情时,该应用程序不会注册他,弹出浏览器在他允许访问他的公众后在控制台中打印出此错误资料 -
DOMException: Blocked a frame with origin "https://myapp.herokuapp.com" from accessing cross-origin frame.
这个错误似乎来自end_of_popup_response.js:18于oauth包中.
这个错误有什么特别的可修复原因吗?
While downloading accounts-base@1.2.11...:
error: certificate has expired
While downloading accounts-password@1.3.0...:
error: certificate has expired
While downloading alanning:roles@1.2.15...:
error: certificate has expired
While downloading aldeed:collection2@2.10.0...:
error: certificate has expired
While downloading aldeed:collection2-core@1.2.0...:
error: certificate has expired
While downloading aldeed:schema-deny@1.1.0...:
Run Code Online (Sandbox Code Playgroud)
甚至尝试设置 NODE_TLS_REJECT_UNAUTHORIZED=0 然后运行meteor。但仍然出现错误。
meteor meteor-blaze meteor-accounts visual-studio-code angular-meteor
在 React-router 中使用“onEnter”属性时,replace()函数在回调中对我不起作用。当它以同步方式(而不是在回调中)调用时,它工作正常:
function verifyEmail(nextState, replace) {
replace({pathname: '/list'});
}
<Route path="/" component={App}>
<Route path="/verify-email/:token" component={AppNotFound} onEnter={verifyEmail}/>
</Route>
Run Code Online (Sandbox Code Playgroud)
但是,当它用于像这样的回调时,它会停止工作:
function verifyEmail(nextState, replace) {
console.log("replace", replace);
Accounts.verifyEmail( nextState.params.token, function(error){
if ( error ) {
console.log(error.reason);
} else {
console.log("verified successfully!");
replace({pathname: '/list'});
}
});
}
<Route path="/" component={App}>
<Route path="/verify-email/:token" component={AppNotFound} onEnter={verifyEmail}/>
</Route>
Run Code Online (Sandbox Code Playgroud)
控制台日志将显示“已成功验证”,但实际上并未重定向页面。
我一直在搜索 inet 试图找到任何定义如何处理流星和反应路由器 4 中的身份验证的地方。
基本上,我希望某些路由仅对经过身份验证的用户可用。有没有关于它的文档?
阿塞尔
meteor-accounts ×10
meteor ×8
react-router ×3
javascript ×2
reactjs ×2
cordova ×1
cross-domain ×1
email ×1
facebook ×1
ios ×1
mailgun ×1
meteor-blaze ×1
smtp ×1