Authentication react/redux应用程序中的身份验证错误
我正在为应用程序react/redux/webpack构建身份验证(使用bcrypt、jwt),我在将身份验证函数连接到登录容器(我希望在下面的身份验证文件中运行函数并将用户发布到数据库的登录表单)时遇到问题 当我试图将signin函数(import{signin}from./Auth/controllers/authentication')从我的身份验证代码(如下)导入到我的登录容器时,我遇到了一个严重错误。我做错了什么?如何在登录模式/屏幕中使用身份验证功能Authentication react/redux应用程序中的身份验证错误,authentication,reactjs,redux,bcrypt,react-redux,Authentication,Reactjs,Redux,Bcrypt,React Redux,我正在为应用程序react/redux/webpack构建身份验证(使用bcrypt、jwt),我在将身份验证函数连接到登录容器(我希望在下面的身份验证文件中运行函数并将用户发布到数据库的登录表单)时遇到问题 当我试图将signin函数(import{signin}from./Auth/controllers/authentication')从我的身份验证代码(如下)导入到我的登录容器时,我遇到了一个严重错误。我做错了什么?如何在登录模式/屏幕中使用身份验证功能 ERROR in ./~/bcr
ERROR in ./~/bcrypt-nodejs/bCrypt.js
Module parse failed: /Users/myname/Desktop/SaltyEndzone/node_modules/babel-loader/index.js?{"presets":["es2015","react"]}!/Users/myname/Desktop/groupname/node_modules/bcrypt-nodejs/bCrypt.js Line 293: Octal literals are not allowed in strict mode.
You may need an appropriate loader to handle this file type.
| rounds = r1 + r2;
| real_salt = salt.substring(off + 3, off + 25);
| password = password + (minor >= 'a' ? "\000" : "");
|
| var buf = new Buffer(password);
@ ./public/Login/Auth/models/user.js 6:13-37
这就是(错误之一),下面是代码(下面是身份验证,以及登录模式):
以下是登录代码:
import React, { Component } from 'react';
import { render } from 'react-dom';
import { Button, Modal } from 'react-bootstrap';
import { signin } from './Auth/controllers/authentication';
export default class Login extends Component {
render() {
const { openLogin, closeLogin, login } = this.props;
return (
<div>
<div className="login-corner">
<span className="login" onClick={openLogin}>LOGIN</span>
</div>
<Modal className="modal-dialog" bsSize="small" show={login.login} closeTimeoutMS={150}>
<Modal.Body>
<Modal.Title className="login-title">Login</Modal.Title>
</Modal.Body>
<div className="login-input">
<div className="form-group">
<div className="user-input">
<i className="glyphicon glyphicon-user"></i>
<input type="email" className="form-control" placeholder="Username"/>
</div>
<div className="password-input">
<i className="glyphicon glyphicon-lock"></i>
<input type="password" className="form-control" placeholder="Password"/>
</div>
</div>
</div>
<div className="login-button">
<Button className="btn btn-info" onClick={closeLogin}>Welcome Back!</Button>
</div>
<div className="register-button">
<a className="register-link" ui-sref="register" onClick={closeLogin}>Not a member? Sign up!</a>
</div>
</Modal>
</div>
);
}
}
import React,{Component}来自'React';
从'react dom'导入{render};
从“react bootstrap”导入{按钮,模式};
从“./Auth/controllers/authentication”导入{signin};
导出默认类登录扩展组件{
render(){
const{openLogin,closeLogin,login}=this.props;
返回(
登录
登录
欢迎回来!
不是会员?注册吧!
);
}
}
bcrypt NodeJ的回购协议似乎已经失效。建议的替换是
import React, { Component } from 'react';
import { render } from 'react-dom';
import { Button, Modal } from 'react-bootstrap';
import { signin } from './Auth/controllers/authentication';
export default class Login extends Component {
render() {
const { openLogin, closeLogin, login } = this.props;
return (
<div>
<div className="login-corner">
<span className="login" onClick={openLogin}>LOGIN</span>
</div>
<Modal className="modal-dialog" bsSize="small" show={login.login} closeTimeoutMS={150}>
<Modal.Body>
<Modal.Title className="login-title">Login</Modal.Title>
</Modal.Body>
<div className="login-input">
<div className="form-group">
<div className="user-input">
<i className="glyphicon glyphicon-user"></i>
<input type="email" className="form-control" placeholder="Username"/>
</div>
<div className="password-input">
<i className="glyphicon glyphicon-lock"></i>
<input type="password" className="form-control" placeholder="Password"/>
</div>
</div>
</div>
<div className="login-button">
<Button className="btn btn-info" onClick={closeLogin}>Welcome Back!</Button>
</div>
<div className="register-button">
<a className="register-link" ui-sref="register" onClick={closeLogin}>Not a member? Sign up!</a>
</div>
</Modal>
</div>
);
}
}