Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

alaska-field-password

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alaska-field-password - npm Package Compare versions

Comparing version 0.11.12 to 0.12.0

37

index.js

@@ -1,14 +0,17 @@

// @flow
'use strict';
import { Field } from 'alaska';
import bcrypt from 'bcryptjs';
Object.defineProperty(exports, "__esModule", {
value: true
});
export default class PasswordField extends Field {
static plain = String;
static defaultOptions = {
cell: 'PasswordFieldCell',
view: 'PasswordFieldView'
};
workFactor: number;
var _alaska = require('alaska');
var _bcryptjs = require('bcryptjs');
var _bcryptjs2 = _interopRequireDefault(_bcryptjs);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class PasswordField extends _alaska.Field {
initSchema() {

@@ -40,3 +43,3 @@ let field = this;

/**
* [async] 比较密码
* 比较密码
* @params {string} candidate

@@ -52,3 +55,3 @@ */

}
bcrypt.compare(candidate, record.get(field.path), (error, res) => {
_bcryptjs2.default.compare(candidate, record.get(field.path), (error, res) => {
if (error) {

@@ -76,3 +79,3 @@ reject(error);

bcrypt.genSalt(field.workFactor, (err, salt) => {
_bcryptjs2.default.genSalt(field.workFactor, (err, salt) => {
if (err) {

@@ -82,3 +85,3 @@ next(err);

}
bcrypt.hash(record.get(field.path), salt, (error, hash) => {
_bcryptjs2.default.hash(record.get(field.path), salt, (error, hash) => {
if (error) {

@@ -96,1 +99,7 @@ next(err);

}
exports.default = PasswordField;
PasswordField.plain = String;
PasswordField.defaultOptions = {
cell: 'PasswordFieldCell',
view: 'PasswordFieldView'
};
{
"name": "alaska-field-password",
"version": "0.11.12",
"version": "0.12.0",
"description": "Alaska password field",

@@ -9,4 +9,5 @@ "keywords": [

],
"alaska": "field",
"main": "index.js",
"repository": "https://github.com/maichong/alaska/tree/master/packages/alaska-field-password",
"repository": "https://github.com/maichong/alaska/tree/master/src/alaska-field-password",
"author": "Liang <liang@maichong.it> (https://github.com/liangxingchen)",

@@ -13,0 +14,0 @@ "license": "MIT",

@@ -5,4 +5,3 @@ // @flow

export default class PasswordFieldCell extends React.Component {
export default class PasswordFieldCell extends React.Component<Alaska$view$Field$Cell$Props> {
shouldComponentUpdate() {

@@ -9,0 +8,0 @@ return false;

@@ -7,4 +7,9 @@ // @flow

export default class PasswordFieldView extends React.Component {
type State = {
value1: string,
value2: string,
errorText: string
};
export default class PasswordFieldView extends React.Component<Alaska$view$Field$View$Props, State> {
static contextTypes = {

@@ -14,23 +19,6 @@ t: PropTypes.func

props: {
className: string,
model: Object,
field: Object,
data: Object,
errorText: string,
disabled: boolean,
value: any,
onChange: Function,
};
state: {
value1:string,
value2:string,
errorText:string
};
handleChange1: Function;
handleChange2: Function;
constructor(props: Object) {
constructor(props: Alaska$view$Field$View$Props) {
super(props);

@@ -46,7 +34,7 @@ this.state = {

shouldComponentUpdate(props: Object, state: Object) {
shouldComponentUpdate(props: Alaska$view$Field$View$Props, state: State) {
return props.disabled !== this.props.disabled || !shallowEqualWithout(state, this.state);
}
handleChange(index: number, e: Event) {
handleChange(index: number, e: SyntheticInputEvent<*>) {
// $Flow e.target.value确认存在

@@ -57,5 +45,4 @@ this.setState({ ['value' + index]: e.target.value });

handleBlur = () => {
const t = this.context.t;
let value1 = this.state.value1;
let value2 = this.state.value2;
const { t } = this.context;
let { value1, value2 } = this.state;
let newState = {

@@ -77,9 +64,9 @@ errorText: ''

render() {
const t = this.context.t;
const { t } = this.context;
let { className, field, disabled } = this.props;
let state = this.state;
const { state, props } = this;
className += ' password-field';
let help = field.help;
let errorText = this.state.errorText || this.props.errorText;
let { help } = field;
let errorText = state.errorText || props.errorText;
if (errorText) {

@@ -86,0 +73,0 @@ help = errorText;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc