Skip to content

Commit

Permalink
optional terms of use, fix #94
Browse files Browse the repository at this point in the history
  • Loading branch information
rambousek committed Apr 13, 2019
1 parent cf0d0a3 commit 22effae
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion website/lexonomy.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ app.get(siteconfig.rootPath+":dictID/en/", function(req, res){ res.redirect("/"+
//SITEWIDE UI:
app.get(siteconfig.rootPath, function(req, res){
ops.verifyLogin(req.cookies.email, req.cookies.sessionkey, function(user){
if (user.loggedin && !user.consent) {
if (user.loggedin && siteconfig.consent != null && siteconfig.consent.terms != null && !user.consent) {
res.redirect(siteconfig.baseUrl + 'consent/');
}
ops.getDictsByUser(user.email, function(dicts){
Expand Down
4 changes: 2 additions & 2 deletions website/libs/screenful/screenful-consent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Screenful.Consent={
Screenful.createEnvelope(true);
$("#envelope").html("<form id='middlebox'><div class='one'></div><div class='two' style='display: none'></div></form>");
$("#middlebox").append("<div class='title'>"+Screenful.Loc.termsTitle+"</div>");
$("#middlebox").append("<div class=''>"+Screenful.Loc.termsOfUse+"</div>");
$("#middlebox").append("<div class='field consent'><label><input type='checkbox' id='consent'/>"+Screenful.Loc.termsConsent+"</label></div>");
$("#middlebox").append("<div class=''>"+(Screenful.Consentterms.replace(/&lt;/g,'<').replace(/&gt;/g,'>'))+"</div>");
$("#middlebox").append("<div class='field consent'><label><input type='checkbox' id='consent'/>"+Screenful.Consentconfirm+"</label></div>");
$("#middlebox").append("<div class='field submit'><input class='button' type='submit' value='"+Screenful.Loc.confirm+"'/></div>");
$("#middlebox").append("<div class='error' style='display: none'></div>");

Expand Down
2 changes: 0 additions & 2 deletions website/libs/screenful/screenful-loc-en.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ Screenful.Loc={
partialMatches: "Partial matches",

termsTitle: "Terms of Use",
termsOfUse: "Lexonomy is a service provided by <a href='https://www.lexicalcomputing.com' target='_blank'>Lexical Computing CZ s.r.o.</a>. This service is provided free of charge for <b>non-commercial purposes only</b>. Lexonomy is still in the development phase and no warranties are given as for service availability or fitness for particular purpose.<br/><br/>Commercial users as well as users interested in a guaranteed service level need to <a href='mailto:inquiries@sketchengine.eu'>contact us</a> in order to obtain a subscription.",
termsConsent: "My usage is non-commercial and I agree to the terms of use",
confirm: "Confirm",
termsError: "Please, confirm Terms of Use before using Lexonomy.",
};
1 change: 1 addition & 0 deletions website/siteconfig.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"mailconfig": {"host": "smtp.server.example", "port": 465,"secure": true, "from": "noreply@example.com"},
"sketchengineKey": null,
"sketchengineLoginPage": null,
"consent": {"terms": null, "confirm": null},
"licences": {
"cc-by-4.0": {
"title": "Creative Commons Attribution 4.0 International",
Expand Down
2 changes: 2 additions & 0 deletions website/views/consent.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<script type="text/javascript">
Screenful.User.loggedin=<%=(user.loggedin ? "true" : "false")%>;
Screenful.User.username="<%=user.email%>";
Screenful.Consentterms = "<%=siteconfig.consent.terms%>";
Screenful.Consentconfirm = "<%=siteconfig.consent.confirm%>";
</script>
<script type="text/javascript">var rootPath="../";</script>
<script type="text/javascript" src="../furniture/screenful-user-config.js"></script>
Expand Down

0 comments on commit 22effae

Please sign in to comment.