我的流星站点上有一个SignUp/SignIn进程.我有一个表单来注册新用户和一个表单来登录用户.
我serverside通过用户启动用户
Accounts.createUser({username: "myusername", password: "mypassword"});
Run Code Online (Sandbox Code Playgroud)
我可以通过我的登录表单登录到我的dummyusers client与
Meteor.loginWithPassword(username, password)
Run Code Online (Sandbox Code Playgroud)
我不知道为什么但由于某种原因我无法在客户端创建新用户.如果我打电话
Accounts.createUser({username: username, password: password});
Run Code Online (Sandbox Code Playgroud)
它返回undefined(野生动物园)
我检查了输入字符串(用户名,密码),即使是纯字符串也没有生成错误
Accounts.createUser({username: "test", password: "pass"});
Run Code Online (Sandbox Code Playgroud)
返回undefined客户端控制台.
我通过以下方式发布和订阅了我的用户:
服务器
Meteor.publish('users', function () {
console.log("Server Log: publishing all users");
return Meteor.users.find();
});
Run Code Online (Sandbox Code Playgroud)
客户
Meteor.subscribe("users");
Run Code Online (Sandbox Code Playgroud)
我也可以count()在客户端控制台上使用用户,但我无法使用,Accounts.createUser()因此createUser()函数甚至无法在我的控制台中运行.
为什么我不能使用Accounts.createUser()的client/console?
有人想出使用Meteor.js来检测托管环境的语法或模式吗?我有Heroku buildpacks工作,并有一个开发/生产环境,但我有点想知道如何让我的应用程序检测它正在运行的环境.
有没有办法让node.js检测它正在运行哪个端口?我希望可能有像app.address().port这样的低级别东西,但这似乎不起作用......
编辑:这是适合我的解决方案.请注意,需要在服务器上运行以下内容,因此需要将其包含在server\server.js或类似文件中.
if (Meteor.is_server) {
Meteor.startup(function () {
// we want to be able to inspect the root_url, so we know which environment we're in
console.log(JSON.stringify(process.env.ROOT_URL));
// in case we want to inspect other process environment variables
//console.log(JSON.stringify(process.env));
});
}
Run Code Online (Sandbox Code Playgroud)
还创建了以下内容:
Meteor.methods({
getEnvironment: function(){
if(process.env.ROOT_URL == "http://localhost:3000"){
return "development";
}else{
return "staging";
}
}
});
Run Code Online (Sandbox Code Playgroud)
在客户端允许以下内容:
Meteor.call("getEnvironment", function (result) {
console.log("Your application is running in the " + result + "environment.");
});
Run Code Online (Sandbox Code Playgroud)
谢谢Rahul!
我想使用该security.interactive_login事件来更新我的用户的上次登录字段。
活动注册成功:
php bin/console debug:event-dispatcher security.interactive_login
Registered Listeners for "security.interactive_login" Event
===========================================================
------- ------------------------------------------------------------------------ ----------
Order Callable Priority
------- ------------------------------------------------------------------------ ----------
#1 App\EventSubscriber\UserLocaleSubscriber::onSecurityInteractiveLogin() 0
------- ------------------------------------------------------------------------ ----------
Run Code Online (Sandbox Code Playgroud)
但它落在Symfony 分析器中的Not Called Listens上。
这是事件订阅者:
class UserLocaleSubscriber implements EventSubscriberInterface
{
private $em;
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}
public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
{
/** @var User $user */
$user = $event->getAuthenticationToken()->getUser();
$user->setLastLoginAt(new DateTime());
$this->em->persist($user);
$this->em->flush();
}
public static function getSubscribedEvents()
{
return [
SecurityEvents::INTERACTIVE_LOGIN => 'onSecurityInteractiveLogin',
]; …Run Code Online (Sandbox Code Playgroud) events symfony symfony-security symfony-eventdispatcher symfony5
首先是上下文:我想从页脚中删除"联系我们"链接.但是我没有任何contacts.xml,我可以将它注释掉,因为我正在基于空白主题构建我自己的主题.所以先决条件是使用带有布局删除方法的local.xml删除它.
这适用于高级搜索:
<default>
<reference name="footer_links">
<action method="removeLinkByUrl"><url helper="catalogsearch/getAdvancedSearchUrl"/></action>
</reference>
</default>
Run Code Online (Sandbox Code Playgroud)
但这不适用于"联系我们":
<default>
<reference name="footer_links">
<action method="removeLinkByUrl"><url>contacts</url></action>
</reference>
</default>
Run Code Online (Sandbox Code Playgroud)
(还尝试在action的属性中添加module ="contacts")
我做错了什么?
有谁知道是否使用 apache-poi 库可以更改 Microsoft Excel 的小数点和千位分隔符?
我需要在 excel 中从 Web 应用程序导出一些数据,并且数字的格式取决于用户的某些设置。因此,当数据被导出时,数字应该与应用程序页面中的数字完全相同。
谢谢