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

sails-adminpanel

Package Overview
Dependencies
Maintainers
1
Versions
189
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sails-adminpanel - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

2

actions/add.js

@@ -22,2 +22,4 @@ 'use strict';

if (sails.config.adminpanel.auth) req.locals.user = req.session.UserAP;
var fields = fieldsHelper.getFields(req, instance, 'add');

@@ -24,0 +26,0 @@ var data = {}; //list of field values

@@ -15,7 +15,10 @@ 'use strict';

if (!req.session.UserAP && sails.config.adminpanel.auth) {
return res.redirect('/admin/userap/login');
}
if (sails.config.adminpanel.auth) req.locals.user = req.session.UserAP;
return res.viewAdmin('dashboard',{ instance: "instance"});
};

@@ -29,2 +29,4 @@ 'use strict';

if (sails.config.adminpanel.auth) req.locals.user = req.session.UserAP;
instance.model.findOne(req.param('id'))

@@ -31,0 +33,0 @@ .populateAll()

@@ -15,2 +15,4 @@ "use strict";

if (sails.config.adminpanel.auth) req.locals.user = req.session.UserAP;
let records = [];

@@ -17,0 +19,0 @@ var fields = fieldsHelper.getFields(req, instance, 'list');

@@ -30,2 +30,4 @@ 'use strict';

if (sails.config.adminpanel.auth) req.locals.user = req.session.UserAP;
var total = 0;

@@ -32,0 +34,0 @@ var records = [];

50

actions/login.js

@@ -1,28 +0,34 @@

'use strict';
"use strict";
var passwordHash = require('password-hash');
var passwordHash = require("password-hash");
var created = false;
module.exports = function(req, res) {
if (req.url.indexOf('login') >= 0) {
if (req.method.toUpperCase() === 'POST') {
var username = req.param('username');
var password = req.param('password');
UserAP.findOne({username: username}).exec((err, user) => {
if (err) return res.serverError(err);
if (!user) return res.notFound();
if (passwordHash.verify(username + password, user.passwordHashed)) {
req.session.UserAP = user;
res.redirect('/admin/');
} else {
res.forbidden('Wrong username/password');
}
});
} else if (req.method.toUpperCase() === 'GET') {
return res.viewAdmin('login');
module.exports = function (req, res) {
if (req.url.indexOf("login") >= 0) {
if (req.method.toUpperCase() === "POST") {
var username = req.param("username");
var password = req.param("password");
UserAP.findOne({ username: username }).exec((err, user) => {
if (err) return res.serverError(err);
if (!user) {
req.flash("adminError", "Wrong username or password");
return res.viewAdmin("login");
} else {
if (passwordHash.verify(username + password, user.passwordHashed)) {
req.session.UserAP = user;
return res.redirect("/admin/");
} else {
req.flash("adminError", "Wrong username or password");
return res.viewAdmin("login");
}
}
} else if (req.url.indexOf('logout') >= 0) {
req.session.UserAP = undefined;
res.redirect('/admin/');
});
}
if (req.method.toUpperCase() === "GET") {
return res.viewAdmin("login");
}
} else if (req.url.indexOf("logout") >= 0) {
req.session.UserAP = undefined;
res.redirect("/admin/userap/login");
}
};

@@ -22,2 +22,5 @@ 'use strict';

return res.redirect('/admin/userap/login');
if (sails.config.adminpanel.auth) req.locals.user = req.session.UserAP;
/**

@@ -24,0 +27,0 @@ * Searching for record by model

@@ -22,2 +22,4 @@ 'use strict';

if (sails.config.adminpanel.auth) req.locals.user = req.session.UserAP;
if (req.method.toUpperCase() === 'POST') {

@@ -24,0 +26,0 @@ // if this file must not be loaded

@@ -26,2 +26,4 @@ 'use strict';

if (sails.config.adminpanel.auth) req.locals.user = req.session.UserAP;
var query = instance.model

@@ -28,0 +30,0 @@ .findOne(req.param('id'))

@@ -49,3 +49,3 @@ {

},
"version": "1.2.0"
"version": "1.2.1"
}

@@ -122,2 +122,5 @@ sails-adminpanel readme for sails v1.x

Clarity docs https://vmware.github.io/clarity/documentation/v0.13/
## License

@@ -124,0 +127,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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