登录在Meteor的Firefox中不起作用 [英] Login not working in Firefox in Meteor

查看:139
本文介绍了登录在Meteor的Firefox中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在meteor中开发登录功能,我使用jade-handlebars和coffeescript。

I am trying to develop the login functionality in meteor, and I am using jade-handlebars and coffeescript.

我的coffeescript页面:

My coffeescript page:

Template.navigation.events
 "submit #login-form": (e, t) ->
    e.preventDefault()

if Meteor.userId()
  Meteor.logout()

else
  # retrieve the input field values
  email = t.find("#login-email").value
  password = t.find("#login-password").value

  # If validation passes, supply the appropriate fields to the
  # Meteor.loginWithPassword() function.
  Meteor.loginWithPassword email, password, (err) ->
    if err
     # throw new Meteor.Error(403, "Username must have at least 3 characters")
      alert "login unsucess, Please check your email and password currectly"
      console.log err
    else
      alert "sucess"
      $('#login-style').toggleClass('hide');
      console.log Meteor.userId()
      Meteor.Router.to('/')

false

我的jade文件:

body
  .container
    {{> Header}} 

    {{#isolate}}{{renderPage}}{{/isolate}}

template(name="Header")
  {{> navigation}}
template(name="navigation")
    {{#if currentUser}}
      {{> login}}
    {{else}}
      {{> loginout }}
    {{/if}}



在Chrome中运行正常, Firefox请刷新我的页面,以查看登录或注销按钮。

In Chrome it works fine, but in Firefox I have to refresh my page to see the login or logout button.

推荐答案

请尝试返回false而不是e.preventDefault

try returning false instead of e.preventDefault()

请参考此答案。
e.preventDefault();行为在Firefox中无法正常工作?

这篇关于登录在Meteor的Firefox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆