Giter Site home page Giter Site logo

passwordless-postgrestore's People

Contributors

battochon avatar brendanlong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

passwordless-postgrestore's Issues

Can you please push the newest version of this to npm?

There is only one version on the npm registry right now and that's the version using the old version of bcrypt. I want to use this but am unable to install from npm since this current 1.0.0 version is not published to the npm registry.

Failed at the [email protected] install script 'node-gyp rebuild'.

I installed the latest bcrypt (v1.0.2), but I'm getting the error:
Failed at the [email protected] install script 'node-gyp rebuild'.

Does this npm package require bcrypt version 0.7.8 or is there some other issue?

The entire error log is quite long so I didn't include it all, but there are messages such as this:
../src/bcrypt_node.cc:54:18: error: no member named 'Dispose' in 'v8::Persistent<v8::Function, v8::NonCopyablePersistentTraits<v8::Function> >' callback.Dispose();

Disconnect function doesn't make sense?

Maybe I'm missing something, but in this function:

PostgreStore.prototype.disconnect = function() {
    if(!this._pgDone) {
        this._pgDone();
    }
};

Shouldn't this always fail, since functions are truthy, so this will only call _pgDone() if it's null or undefined?

Should this be:

PostgreStore.prototype.disconnect = function() {
    if(this._pgDone) {
        this._pgDone();
    }
};

Use an upsert instead of insert + catch + update

Right now you do this:

        self._client.query('INSERT INTO ' + self._table + '(uid,token, origin, ttl) VALUES($1, $2, $3, $4)',[uid, hashedToken, originUrl, (Date.now() + msToLive)], function(err) {
            if(err){
                self._client.query('UPDATE ' + self._table + ' SET token=$1, origin=$2, ttl=$3 WHERE uid=$4',[hashedToken, originUrl, (Date.now() + msToLive), uid], function(err) {

This ignores all errors in the INSERT, and also requires two round trips.

It would be better to do a single query with an ON CONFLICT (uid) DO UPDATE ....

Test failure with 0.1.4 passwordless-tokenstore-test

npm run test fails on the following

1) should callback in the format of callback(null, true, "") in case of a null referrer

To fix, the origin column must be nullable with a default value of ''

CREATE TABLE passwordless (
    id serial NOT NULL,
    uid character varying(160),
    token character varying(60) NOT NULL,
    origin text default '',
    ttl bigint,
    CONSTRAINT passwordless_pkey PRIMARY KEY (id),
    CONSTRAINT passwordless_token_key UNIQUE (token),
    CONSTRAINT passwordless_uid_key UNIQUE (uid)
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.