Commit 8e268f7f authored by Curtis Adam's avatar Curtis Adam

Add a guest and pro login button and add a server setting to switch between...

Add a guest and pro login button and add a server setting to switch between the new login or old one (Twitter, Google, Facebook)
parent fcec21fe
......@@ -25,7 +25,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="white">
<script>window.markdeepOptions = {mode: 'script', detectMath: false};</script>
<meta name="google-site-verification" content="rN3x14QkdqbdL3gcMmu8uzuqQ7mvfWaWME3bmM0ShNY" />
<!-- <script src="https://js.braintreegateway.com/v2/braintree.js"></script> -->
<script src="https://js.braintreegateway.com/v2/braintree.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.js"></script>
<noscript>
......
......@@ -89,6 +89,14 @@ $themes: (
$login_cas_background_hover: map-get($map, "login_cas_background_hover");
$login_cas_icon: map-get($map, "login_cas_icon");
$login_cas_icon_hover: map-get($map, "login_cas_icon_hover");
$login_guest_background: map-get($map, "login_guest_background");
$login_guest_background_hover: map-get($map, "login_guest_background_hover");
$login_guest_icon: map-get($map, "login_guest_icon");
$login_guest_icon_hover: map-get($map, "login_guest_icon_hover");
$login_pro_background: map-get($map, "login_pro_background");
$login_pro_background_hover: map-get($map, "login_pro_background_hover");
$login_pro_icon: map-get($map, "login_pro_icon");
$login_pro_icon_hover: map-get($map, "login_pro_icon_hover");
$login_backdoor_background: map-get($map, "login_backdoor_background");
$login_backdoor_background_hover: map-get($map, "login_backdoor_background_hover");
$login_backdoor_icon: map-get($map, "login_backdoor_icon");
......@@ -796,6 +804,7 @@ $themes: (
#cas {
background-color: $login_cas_background !important;
color: $login_cas_icon !important;
.login-button-icon {
background-color: $login_cas_icon !important;
}
......@@ -803,13 +812,47 @@ $themes: (
#cas:hover, #cas:focus {
background-color: $login_cas_background_hover !important;
color: $login_cas_icon_hover !important;
.login-button-icon {
background-color: $login_cas_icon_hover !important;
}
}
#guest {
background-color: $login_guest_background !important;
color: $login_guest_icon !important;
.login-button-icon {
background-color: $login_guest_icon !important;
}
}
#guest:hover, #guest:focus {
background-color: $login_guest_background_hover !important;
color: $login_guest_icon_hover !important;
.login-button-icon {
background-color: $login_guest_icon_hover !important;
}
}
#pro {
background-color: $login_pro_background !important;
color: $login_pro_icon !important;
.login-button-icon {
background-color: $login_pro_icon !important;
}
}
#pro:hover, #pro:focus {
background-color: $login_pro_background_hover !important;
color: $login_pro_icon_hover !important;
.login-button-icon {
background-color: $login_pro_icon_hover !important;
}
}
#facebook {
background-color: $login_facebook_background !important;
color: $login_facebook_icon !important;
.login-button-icon {
background-color: $login_facebook_icon !important;
}
......@@ -817,6 +860,7 @@ $themes: (
#facebook:hover, #facebook:focus {
background-color: $login_facebook_background_hover !important;
color: $login_facebook_icon_hover !important;
.login-button-icon {
background-color: $login_facebook_icon_hover !important;
}
......@@ -824,6 +868,7 @@ $themes: (
#twitter {
background-color: $login_twitter_background !important;
color: $login_twitter_icon !important;
.login-button-icon {
background-color: $login_twitter_icon !important;
}
......@@ -831,6 +876,7 @@ $themes: (
#twitter:hover, #twitter:focus {
background-color: $login_twitter_background_hover !important;
color: $login_twitter_icon_hover !important;
.login-button-icon {
background-color: $login_twitter_icon_hover !important;
}
......@@ -838,6 +884,7 @@ $themes: (
#google {
background-color: $login_google_background !important;
color: $login_google_icon !important;
.login-button-icon {
background-color: $login_google_icon !important;
}
......@@ -845,6 +892,7 @@ $themes: (
#google:hover, #google:focus {
background-color: $login_google_background_hover !important;
color: $login_google_icon_hover !important;
.login-button-icon {
background-color: $login_google_icon_hover !important;
}
......@@ -852,6 +900,7 @@ $themes: (
#BackdoorLogin {
background-color: $login_backdoor_background !important;
color: $login_backdoor_icon !important;
.login-button-icon {
background-color: $login_backdoor_icon !important;
}
......@@ -859,6 +908,7 @@ $themes: (
#BackdoorLogin:hover, #BackdoorLogin:focus {
background-color: $login_backdoor_background_hover !important;
color: $login_backdoor_icon_hover !important;
.login-button-icon {
background-color: $login_backdoor_icon_hover !important;
}
......
......@@ -118,6 +118,14 @@
"login_cas_background_hover": $button_background_hover,
"login_cas_icon": white,
"login_cas_icon_hover": $button_text_hover,
"login_guest_background": $primary,
"login_guest_background_hover": $button_background_hover,
"login_guest_icon": white,
"login_guest_icon_hover": $button_text_hover,
"login_pro_background": $primary,
"login_pro_background_hover": $button_background_hover,
"login_pro_icon": white,
"login_pro_icon_hover": $button_text_hover,
"login_backdoor_background": $primary,
"login_backdoor_background_hover": $button_background_hover,
"login_backdoor_icon": white,
......
......@@ -116,10 +116,18 @@
"login_google_background_hover": $button_background_hover,
"login_google_icon": white,
"login_google_icon_hover": $button_text_hover,
"login_cas_background": $primary,
"login_cas_background": $thm_green,
"login_cas_background_hover": $button_background_hover,
"login_cas_icon": white,
"login_cas_icon_hover": $button_text_hover,
"login_guest_background": $thm_blue,
"login_guest_background_hover": $button_background_hover,
"login_guest_icon": white,
"login_guest_icon_hover": $button_text_hover,
"login_pro_background": $thm_orange,
"login_pro_background_hover": $button_background_hover,
"login_pro_icon": white,
"login_pro_icon_hover": $button_text_hover,
"login_backdoor_background": $primary,
"login_backdoor_background_hover": $button_background_hover,
"login_backdoor_icon": white,
......
......@@ -33,6 +33,14 @@
"backButton": "Zurück",
"backToStartButton": "Zurück zur Startseite"
},
"landingPage": {
"login": {
"cas": "Uni-Login",
"guest": "Gast-Login",
"pro": "Pro-Login",
"backdoor": "Backdoor-Login"
}
},
"pomodoro": {
"tooltip": "Pomodoro-Timer für dein Zeitmanagement – »Pomodoro« ist italienisch für \uD83C\uDF45",
"name": "Pomodoro",
......
......@@ -271,6 +271,10 @@ Template.registerHelper("learningActiveAndEditor", function () {
}
});
Template.registerHelper("isLegacyLoginActive", function () {
return Meteor.settings.public.login.legacyMode.enabled;
});
Template.registerHelper("isEditor", function () {
if (Roles.userIsInRole(Meteor.userId(), ['admin', 'editor'])) {
return true;
......
......@@ -31,8 +31,7 @@ ServiceConfiguration.configurations.insert({
Meteor.users.after.insert(function (userId, doc) {
// Setup roles for backdoor login, required for acceptance tests
if (Meteor.settings.public.displayLoginButtons.displayTestingBackdoor)
{
if (Meteor.settings.public.login.backdoor) {
let backdoorRoles = ['firstLogin'];
let username = "";
let firstName = "";
......
......@@ -21,6 +21,7 @@ BrowserPolicy.content.allowOriginForAll('https://casual-effects.com');
BrowserPolicy.content.allowOriginForAll('https://www.linguee.de');
BrowserPolicy.content.allowOriginForAll('https://translate.google.com');
BrowserPolicy.content.allowOriginForAll('https://www.deepl.com');
BrowserPolicy.content.allowOriginForAll('https://*.braintreegateway.com');
BrowserPolicy.content.allowFrameOrigin('*');
......
......@@ -35,14 +35,14 @@
<div class="controls col-md-9">
<div id="publishKind" class="btn-group-justified"
data-toggle="buttons">
<div class="col-xs-4 btn-bootstrap-container">
<div class="{{#if isLegacyLoginActive}}col-xs-4{{else}}col-xs-3{{/if}} btn-bootstrap-container">
<label id="kindoption0"
class="btn btn-block btn-warning {{#if kindIsActive 'personal'}}active{{/if}}">
<input type="radio" name="kind" value="personal" id="kind_private">
<span class="flex-content">{{_ 'access-level.private.short'}}</span>
</label>
</div>
<div class="col-xs-4 btn-bootstrap-container">
<div class="{{#if isLegacyLoginActive}}col-xs-4{{else}}col-xs-3{{/if}} btn-bootstrap-container">
<label id="kindoption1"
class="btn btn-block btn-info {{#if kindIsActive 'free'}}active{{/if}}">
<input type="radio" name="kind" value="free" id="free">
......@@ -50,7 +50,7 @@
</label>
</div>
{{#if isInRole 'admin,editor,lecturer'}}
<div class="col-xs-4 btn-bootstrap-container">
<div class="{{#if isLegacyLoginActive}}col-xs-4{{else}}col-xs-3{{/if}} btn-bootstrap-container">
<label id="kindoption2"
class="btn btn-block btn-success {{#if kindIsActive 'edu'}}active{{/if}}">
<input type="radio" name="kind" value="edu" id="kind_edu">
......@@ -58,17 +58,17 @@
</label>
</div>
{{/if}}
{{!--
{{#if isInRole 'admin,editor,lecturer,pro'}}
<div class="col-xs-3 btn-bootstrap-container">
<label id="kindoption3"
class="btn btn-block btn-danger {{#if kindIsActive 'pro'}}active{{/if}}">
<input type="radio" name="kind" value="pro" id="kind_pro">
<span class="flex-content">{{_ 'access-level.pro.short'}}</span>
</label>
</div>
{{/if}}
--}}
{{#unless isLegacyLoginActive}}
{{#if isInRole 'admin,editor,lecturer,pro'}}
<div class="col-xs-3 btn-bootstrap-container">
<label id="kindoption3"
class="btn btn-block btn-danger {{#if kindIsActive 'pro'}}active{{/if}}">
<input type="radio" name="kind" value="pro" id="kind_pro">
<span class="flex-content">{{_ 'access-level.pro.short'}}</span>
</label>
</div>
{{/if}}
{{/unless}}
</div>
</div>
</div>
......
......@@ -3,27 +3,36 @@
<div id="filterCheckbox" class="btn-group" role="group" data-toggle="buttons"
aria-label="License group" style="padding-top: 20px;">
{{#if gotPersonalKind}}
<label class="btn btn-warning btn-sm {{#if isPersonalKindActive}}kindButtonActive active{{else}}kindButtonInactive{{/if}}" data-kind="{{getPersonalKindTag}}">
<span class="flex-content" data-kind="{{getPersonalKindTag}}">{{_ 'access-level.private.short'}}</span>
<label class="btn btn-warning btn-sm {{#if
isPersonalKindActive}}kindButtonActive active{{else}}kindButtonInactive{{/if}}"
data-kind="{{getPersonalKindTag}}">
<span class="flex-content" data-kind="{{getPersonalKindTag}}">{{_
'access-level.private.short'}}</span>
</label>
{{/if}}
{{#if gotFreeKind}}
<label class="btn btn-info btn-sm {{#if isFreeKindActive}}kindButtonActive active{{else}}kindButtonInactive{{/if}}" data-kind="{{getFreeKindTag}}">
<span class="flex-content" data-kind="{{getFreeKindTag}}">{{_ 'access-level.free.short'}}</span>
<label class="btn btn-info btn-sm {{#if
isFreeKindActive}}kindButtonActive active{{else}}kindButtonInactive{{/if}}"
data-kind="{{getFreeKindTag}}">
<span class="flex-content" data-kind="{{getFreeKindTag}}">{{_ 'access-level.free.short'}}</span>
</label>
{{/if}}
{{#if gotEduKind}}
<label class="btn btn-success btn-sm {{#if isEduKindActive}}kindButtonActive active{{else}}kindButtonInactive{{/if}}" data-kind="{{getEduKindTag}}">
<label class="btn btn-success btn-sm {{#if
isEduKindActive}}kindButtonActive active{{else}}kindButtonInactive{{/if}}"
data-kind="{{getEduKindTag}}">
<span class="flex-content" data-kind="{{getEduKindTag}}">{{_ 'access-level.edu.short'}}</span>
</label>
{{/if}}
{{!--
{{#if gotProKind}}
<label class="btn btn-danger btn-sm {{#if isProKindActive}}kindButtonActive active{{else}}kindButtonInactive{{/if}}" data-kind="{{getProKindTag}}">
<span class="flex-content" data-kind="{{getProKindTag}}">{{_ 'access-level.pro.short'}}</span>
</label>
{{/if}}
--}}
{{#unless isLegacyLoginActive}}
{{#if gotProKind}}
<label class="btn btn-danger btn-sm {{#if
isProKindActive}}kindButtonActive active{{else}}kindButtonInactive{{/if}}"
data-kind="{{getProKindTag}}">
<span class="flex-content" data-kind="{{getProKindTag}}">{{_ 'access-level.pro.short'}}</span>
</label>
{{/if}}
{{/unless}}
</div>
</ul>
</template>
<!--##################################################################-->
<!--profileMembership-->
<!--##################################################################-->
......@@ -11,7 +10,7 @@
<div class="panel-body">
<div>{{_ "billing.plan.desc"}}</div>
<br>
<div class="col-md-6">
<div class="{{#if isLegacyLoginActive}}col-md-12{{else}}col-md-6{{/if}}">
<div class="panel price {{#if isInRole 'standard'}}panel-success{{else}}panel-default{{/if}}">
<div class="panel-heading text-center standard-membership">
<h3>{{_ 'access-level.edu.short'}}</h3>
......@@ -44,42 +43,44 @@
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel price {{#if isInRole 'pro'}}panel-success{{else}}panel-default{{/if}}">
<div class="panel-heading text-center pro-membership">
<h3>{{_ 'access-level.pro.short'}}</h3>
</div>
<div class="panel-body text-center">
<div class="lead">
<h2>{{getPrice "6.99"}} / {{_ "billing.plan.month"}}</h2></div>
</div>
<ul class="list-group list-group-flush text-center">
<li class="list-group-item green-passage"><i class="fa fa-check"></i> {{_
"billing.plan.free"}}</li>
<li class="list-group-item green-passage"><i class="fa fa-university"></i> {{_
"billing.plan.edu"}}</li>
<li class="list-group-item green-passage"><i class="fa fa-star"></i> {{_
"billing.plan.pro"}}</li>
</ul>
<div class="panel-footer">
{{#if isInRole 'pro'}}
<button id="upgrade" class="btn btn-block btn-success btn-raised disabled">{{_
"billing.plan.actual"}}</button>
{{else}}
<form role="form">
<div class="row">
<div class="col-md-12">
<div id="subscribe-form"></div>
<button type="submit" id="upgrade"
class="btn btn-block btn-info btn-raised col-xs-12">{{_
"billing.plan.subscribe"}}</button>
{{#unless isLegacyLoginActive}}
<div class="col-md-6">
<div class="panel price {{#if isInRole 'pro'}}panel-success{{else}}panel-default{{/if}}">
<div class="panel-heading text-center pro-membership">
<h3>{{_ 'access-level.pro.short'}}</h3>
</div>
<div class="panel-body text-center">
<div class="lead">
<h2>{{getPrice "6.99"}} / {{_ "billing.plan.month"}}</h2></div>
</div>
<ul class="list-group list-group-flush text-center">
<li class="list-group-item green-passage"><i class="fa fa-check"></i> {{_
"billing.plan.free"}}</li>
<li class="list-group-item green-passage"><i class="fa fa-university"></i> {{_
"billing.plan.edu"}}</li>
<li class="list-group-item green-passage"><i class="fa fa-star"></i> {{_
"billing.plan.pro"}}</li>
</ul>
<div class="panel-footer">
{{#if isInRole 'pro'}}
<button id="upgrade" class="btn btn-block btn-success btn-raised disabled">{{_
"billing.plan.actual"}}</button>
{{else}}
<form role="form">
<div class="row">
<div class="col-md-12">
<div id="subscribe-form"></div>
<button type="submit" id="upgrade"
class="btn btn-block btn-info btn-raised col-xs-12">{{_
"billing.plan.subscribe"}}</button>
</div>
</div>
</div>
</form>
{{/if}}
</form>
{{/if}}
</div>
</div>
</div>
</div>
{{/unless}}
</div>
</div>
<div class="panel panel-default">
......
......@@ -87,7 +87,7 @@ Template.welcome.events({
// Backdoor for login in acceptance tests
'click #BackdoorLogin': function () {
if (Meteor.settings.public.displayLoginButtons.displayTestingBackdoor) {
if (Meteor.settings.public.login.backdoor) {
Meteor.insecureUserLogin($("#TestingBackdoorUsername").val(), function (err, result) {
if (result) {
setActiveLanguage();
......@@ -108,21 +108,32 @@ Template.welcome.events({
Template.welcome.helpers({
getLoginButtons: function () {
let loginButtons = "<div id='loginButtonRow'>";
if (Meteor.settings.public.displayLoginButtons.displayCas) {
loginButtons += '<a id="cas" href=""><div class="' + getLoginClass() + '"></div></a>';
}
if (Meteor.settings.public.displayLoginButtons.displayFacebook) {
loginButtons += '<a id="facebook" href=""><div class="' + getLoginClass() + '"></div></a>';
}
if (Meteor.settings.public.displayLoginButtons.displayTwitter) {
loginButtons += '<a id="twitter" href=""><div class="' + getLoginClass() + '"></div></a>';
}
if (Meteor.settings.public.displayLoginButtons.displayGoogle) {
loginButtons += '<a id="google" href=""><div class="' + getLoginClass() + '"></div></a>';
if (Meteor.settings.public.login.legacyMode.enabled) {
if (Meteor.settings.public.login.cas) {
loginButtons += '<a id="cas" href=""><div class="' + getLoginClass() + '"></div></a>';
}
if (Meteor.settings.public.login.legacyMode.facebook) {
loginButtons += '<a id="facebook" href=""><div class="' + getLoginClass() + '"></div></a>';
}
if (Meteor.settings.public.login.legacyMode.twitter) {
loginButtons += '<a id="twitter" href=""><div class="' + getLoginClass() + '"></div></a>';
}
if (Meteor.settings.public.login.legacyMode.google) {
loginButtons += '<a id="google" href=""><div class="' + getLoginClass() + '"></div></a>';
}
} else {
if (Meteor.settings.public.login.cas) {
loginButtons += '<button id="cas" class="btn btn-large btn-raised btn-block"><span class="flex-content"><i class="fa fa-graduation-cap"></i>' + TAPi18n.__("landingPage.login.cas") + '</span></button>';
}
if (Meteor.settings.public.login.guest) {
loginButtons += '<button id="guest" class="btn btn-large btn-raised btn-block" data-toggle="modal" data-target="#underDevelopmentModal"><span class="flex-content"><i class="fa fa-user"></i>' + TAPi18n.__("landingPage.login.guest") + '</span></button>';
}
if (Meteor.settings.public.login.pro) {
loginButtons += '<button id="pro" class="btn btn-large btn-raised btn-block" data-toggle="modal" data-target="#underDevelopmentModal"><span class="flex-content"><i class="fa fa-credit-card"></i>' + TAPi18n.__("landingPage.login.pro") + '</span></button>';
}
}
// Backdoor for login in acceptance tests
if (Meteor.settings.public.displayLoginButtons.displayTestingBackdoor) {
if (Meteor.settings.public.login.backdoor) {
let title = TAPi18n.__("backdoor.title");
let superAdmin = TAPi18n.__("backdoor.superAdmin");
let admin = TAPi18n.__("backdoor.admin");
......@@ -132,8 +143,16 @@ Template.welcome.helpers({
let standard = TAPi18n.__("backdoor.standard");
let blocked = TAPi18n.__("backdoor.blocked");
let firstLogin = TAPi18n.__("backdoor.firstLogin");
loginButtons += '<a id="BackdoorLogin" href=""><div class="' + getLoginClass() + '"></div></a>';
loginButtons += '<div class="btn-group backdoorLogin"><label id="backdoor-label">' + title + '</label><br><select class="btn btn-secondary btn-raised" id="TestingBackdoorUsername" aria-labelledby="backdoor-label">' +
if (Meteor.settings.public.login.legacyMode.enabled) {
loginButtons += '<a id="BackdoorLogin" href=""><div class="' + getLoginClass() + '"></div></a>';
} else {
loginButtons += '<button id="BackdoorLogin" class="btn btn-large btn-raised btn-block"><span class="flex-content"><i class="fa fa-key"></i>' + TAPi18n.__("landingPage.login.backdoor") + '</span></button>';
}
loginButtons += '<div class="btn-group backdoorLogin">';
if (Meteor.settings.public.login.legacyMode.enabled) {
loginButtons += '<label id="backdoor-label">' + title + '</label><br>';
}
loginButtons += '<select class="btn btn-secondary btn-raised" id="TestingBackdoorUsername" aria-labelledby="backdoor-label">' +
'<option id="superAdminLogin" value="admin">' + superAdmin + '</option>' +
'<option id="adminLogin" value="editor">' + admin + '</option>' +
'<option id="proLogin" value="pro">' + pro + '</option>' +
......
......@@ -7,11 +7,17 @@
"popupWidth": 810,
"popupHeight": 610
},
"displayLoginButtons": {
"displayFacebook": true,
"displayTwitter": true,
"displayGoogle": true,
"displayCas": true
"login": {
"legacyMode": {
"enabled": false,
"facebook": true,
"twitter": true,
"google": true
},
"cas": true,
"guest": true,
"pro": true,
"backdoor": false
},
"leitner": {
"dayIntervalHour": 1
......
......@@ -7,12 +7,17 @@
"popupWidth": 810,
"popupHeight": 610
},
"displayLoginButtons": {
"displayFacebook": true,
"displayTwitter": true,
"displayGoogle": true,
"displayCas": true,
"displayTestingBackdoor": true
"login": {
"legacyMode": {
"enabled": false,
"facebook": true,
"twitter": true,
"google": true
},
"cas": true,
"guest": true,
"pro": true,
"backdoor": true
},
"leitner": {
"dayIntervalHour": 1
......
......@@ -7,12 +7,17 @@
"popupWidth": 810,
"popupHeight": 610
},
"displayLoginButtons": {
"displayFacebook": false,
"displayTwitter": false,
"displayGoogle": false,
"displayCas": false,
"displayTestingBackdoor": true
"login": {
"legacyMode": {
"enabled": false,
"facebook": true,
"twitter": true,
"google": true
},
"cas": false,
"guest": false,
"pro": false,
"backdoor": true
},
"leitner": {
"dayIntervalHour": 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment