Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Fail messaged to be displayed for msg query parameter in redirect.
const msgs = {
fail: 'Login has failed.<br>'
+ 'This may be due to insufficient priviliges or the account being locked.<br>'
+ 'Please check your inbox for an email with additional details.',
validation: 'Please check your inbox for an email with additional details.',
reset: 'The password has been reset for this account.',
approval: 'This account has been verified but requires administrator approval.',
badconfig: 'There seems to be a problem with the ACL configuration.'
};
// Send login view to client.
res
.type('text/html')
.send(jsr
.templates('./public/views/login.html')
.render({
dir: env.path,
action: req.req.url,
msg: req.query.msg ? msgs[req.query.msg] : null,
captcha: env.captcha && env.captcha[0],
}));
}
QUnit.test("jsrender.templates", function(assert) {
var tmpl = jsrender.templates('./test/templates/name-template.html');
var html = tmpl({name: "Jo"});
assert.equal(html, "Name: Jo (name-template.html)", 'jsrender.templates("./file.path.html") compiles template');
tmpl = jsrender.templates({markup: 'Some {{:~upper("Markup")}} Name: {{:~upper(name)}} {{lower:name}}', helpers: {upper:upper}, converters: {lower:lower}});
html = tmpl({name: "Jo"});
assert.equal(html, "Some MARKUP Name: JO jo", 'jsrender.templates({markup: ..., helpers: ..., ...}) compiles template with options');
});
QUnit.test("jsrender.templates", function(assert) {
var tmpl = jsrender.templates('./test/templates/name-template.html');
var html = tmpl({name: "Jo"});
assert.equal(html, "Name: Jo (name-template.html)", 'jsrender.templates("./file.path.html") compiles template');
tmpl = jsrender.templates({markup: 'Some {{:~upper("Markup")}} Name: {{:~upper(name)}} {{lower:name}}', helpers: {upper:upper}, converters: {lower:lower}});
html = tmpl({name: "Jo"});
assert.equal(html, "Some MARKUP Name: JO jo", 'jsrender.templates({markup: ..., helpers: ..., ...}) compiles template with options');
});
QUnit.test("jsrender.tags.clientTemplate", function(assert) {
jsrender.views.settings.delimiters("<%", "%>");
var tmpl = jsrender.compile(
'\n'
+ '\n'
+ '<%clientTemplate "./test/templates/outer.html"/%>\n'
+ '<%clientTemplate "./test/templates/inner.html"/%>\n'
+ '\n'
+ '<div id="result"></div>\n'
+ '');
var html = tmpl({name: "Jo"});
assert.equal(html,
'\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '<div id="result"></div>\n'
+ '',
QUnit.test("jsrender.compile", function(assert) {
var tmpl = jsrender.compile('./test/templates/name-template.html');
var html = tmpl({name: "Jo"});
assert.equal(html, "Name: Jo (name-template.html)", 'jsrender.compile("./file.path.html") compiles template');
tmpl = jsrender.compile('Some {{:~upper("Markup")}} Name: {{:~upper(name)}} {{lower:name}}', {helpers: {upper:upper}, converters: {lower:lower}});
html = tmpl({name: "Jo"});
assert.equal(html, "Some MARKUP Name: JO jo", 'jsrender.compile("markup", {helpers: ..., ...}) compiles template with options');
});
QUnit.test("jsrender.compile", function(assert) {
var tmpl = jsrender.compile('./test/templates/name-template.html');
var html = tmpl({name: "Jo"});
assert.equal(html, "Name: Jo (name-template.html)", 'jsrender.compile("./file.path.html") compiles template');
tmpl = jsrender.compile('Some {{:~upper("Markup")}} Name: {{:~upper(name)}} {{lower:name}}', {helpers: {upper:upper}, converters: {lower:lower}});
html = tmpl({name: "Jo"});
assert.equal(html, "Some MARKUP Name: JO jo", 'jsrender.compile("markup", {helpers: ..., ...}) compiles template with options');
});
QUnit.test("jsrender.renderFile / jsrender.__express", function(assert) {
var html = jsrender.renderFile('./test/templates/name-template.html', {name: "Jo"});
assert.equal(html, "Name: Jo (name-template.html)", 'jsrender.renderFile("./file.path.html", data) loads and renders template');
html = jsrender.__express('./test/templates/name-template.html', {name: "Jo"});
assert.equal(html, "Name: Jo (name-template.html)", 'jsrender.__express("./file.path.html", data) loads and renders template');
});
QUnit.test("jsrender.renderFile / jsrender.__express", function(assert) {
var html = jsrender.renderFile('./test/templates/name-template.html', {name: "Jo"});
assert.equal(html, "Name: Jo (name-template.html)", 'jsrender.renderFile("./file.path.html", data) loads and renders template');
html = jsrender.__express('./test/templates/name-template.html', {name: "Jo"});
assert.equal(html, "Name: Jo (name-template.html)", 'jsrender.__express("./file.path.html", data) loads and renders template');
});
QUnit.test("jsrender.tags.clientTemplate", function(assert) {
jsrender.views.settings.delimiters("<%", "%>");
var tmpl = jsrender.compile(
'\n'
+ '\n'
+ '<%clientTemplate "./test/templates/outer.html"/%>\n'
+ '<%clientTemplate "./test/templates/inner.html"/%>\n'
+ '\n'
+ '<div id="result"></div>\n'
+ '');
var html = tmpl({name: "Jo"});
assert.equal(html,
'\n'
+ '\n'
+ '\n'
+ '\n'
+ '\n'
+ '<div id="result"></div>\n'
for(var index in errors){
var error={errorType:null,errDes:'',ln:0};
error.errDes=!!( errors[index].description)?
errors[index].description: errors[index].message;
if(errors[index].yamlError){
error.errorType = 'Yaml Error';
error.ln=errors[index].lineNumber;
} else {
error.errorType = 'Simple Yaml Error';
var range = positionRangeForPath(input, errors[index].path);
error.ln = range.start.line + 1;
}
console.log(error.errDes);
var t = jsrender.templates('#errorTemp').render(error);
console.log(t);
$(t).appendTo('#errors');
}
}