How to use user - 10 common examples

To help you get started, we’ve selected a few user examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github davidmerfield / Blot / app / routes / dashboard / settings / blog.js View on Github external
function then (avatarError, avatarURL) {

        if (avatarURL) updates.blog.avatar = avatarURL;

        User.set(uid, updates.user, function(userErrors, userChanges){

          Blog.set(blogID, updates.blog, function(blogErrors, blogChanges){

            var changes = userChanges.concat(blogChanges);

            if (changes.indexOf('timeZone') > -1 ||
                changes.indexOf('dateDisplay') > -1) {

              Blog.get({id: blog.id}, function(err, blog){

                Entries.each(blogID, function(entry, nextEntry){

                  var dateStamp = DateStamp(blog, entry.path, entry.metadata);

                  // This is fine!
                  if (dateStamp === undefined) return nextEntry();
github davidmerfield / Blot / app / dashboard / routes / account / change-dropbox / save-credentials.js View on Github external
}, function(){

          User.set(old_uid, changes, function(err){

            if (err) return next(err);

            var multi = redis.multi();

            multi.set("customer:" + customer_id, new_uid);
            multi.rename("user:" + old_uid + ":info", "user:" + new_uid + ":info");

            multi.exec(function(err){

              if (err) return next(err);

              req.session.uid = new_uid;

              res.redirect('/account/change-dropbox/copy-files');
            });
github davidmerfield / Blot / app / dashboard / routes / account / cancel.js View on Github external
if (err) {
            res.message({error: err.message || ERROR, url: ROUTE});
            return res.redirect(req.path);
          }

          if (!subscription) {
            res.message({error: ERROR, url: ROUTE});
            return res.redirect(req.path);
          }

          var changes = {
            subscription: subscription,
            isDisabled: isDisabled
          };

          User.set(uid, changes, function(errors){

            if (errors) throw errors;

            forEach(user.blogs, function(blogID, nextBlog){

              Blog.set(blogID, {isDisabled: isDisabled}, nextBlog);

            }, function(){

              var andDisabled = isDisabled ? ' and disabled your account' : '';

              email.CANCELLED(uid, {andDisabled: andDisabled});

              if (isDisabled) {
                return req.session.destroy(function(){
                  res.redirect('/disabled');
github davidmerfield / Blot / scripts / blog / switch-blog-id-format / updateUser.js View on Github external
var changes = {};

          if (user.blogs.indexOf(oldBlogID) > -1) {
            changes.blogs = user.blogs.filter(function(id) {
              return id !== oldBlogID;
            });
            changes.blogs.push(newBlogID);
          }

          if (user.lastSession === oldBlogID) {
            changes.lastSession = newBlogID;
          }

          if (!Object.keys(changes).length) return next();

          User.set(uid, changes, next);
        });
      },
github davidmerfield / Blot / app / models / blog / remove.js View on Github external
return callback();
    }

    var changes = {};

    var blogs = user.blogs.slice();

    blogs = blogs.filter(function(otherBlogID) {
      return otherBlogID !== blog.id;
    });

    changes.blogs = blogs;

    if (user.lastSession === blog.id) changes.lastSession = "";

    User.set(blog.owner, changes, callback);
  });
}

user

users use your site

MIT
Latest version published 10 years ago

Package Health Score

47 / 100
Full package analysis

Popular user functions