Commit a7d6f961 authored by Matthias Larisch's avatar Matthias Larisch

Merge branch 'foodsaver-module-webpack'

parents 934d379e 88d2130f
Pipeline #22500753 canceled with stages
......@@ -8,8 +8,12 @@
- decreased distance to "close baskets" from 50 to 30 km. !332 #338 by @peter.toennies
- sort fairtiler list by name. !357 #171 by @k.miklobusec
- Store Managers business card creation for region. Remove country card. !76 by @k.miklobusec
- Registered users need to fill their birthday and be 18+ for data protection and liability reasons. !377 @NerdyProjects
- Remove google analytics !374 @NerdyProjects
- Remove external paypal donate button and host locally !374 @NerdyProjects
## Bugfixes
- Removing a user from regions is possible again. !372 #14 @NerdyProjects
- Remove info section from foodsaver page, if it is empty !320
- It is possible to contact working groups again. !343 #403 by @peter.toennies @NerdyProjects
- Fix store fetch count shown on map info bubble !265 @alangecker @NerdyProjects
......
......@@ -59,6 +59,7 @@ module.exports = {
// We explicitly define each foodsharing modules here so we can convert them one-by-one
'Index',
'Dashboard',
'Foodsaver',
'WorkGroup'
),
mode: dev ? 'development' : 'production',
......
......@@ -62,7 +62,7 @@ var join = {
})
},
finish: function(){
if($('#join_legal1:checked').length <= 0)
{
pulseError('Bitte akzeptiere unsere Datenschutzerkl&auml;rung');
......@@ -77,7 +77,7 @@ var join = {
{
$('#joinform').hide();
$('#joinloader').show();
$.ajax({
url: '/xhrapp.php?app=login&m=joinsubmit',
type:'post',
......@@ -88,6 +88,7 @@ var join = {
surname:$('#login_surname').val(),
email:$('#login_email').val(),
pw:$('#login_passwd1').val(),
birthdate:$('#birthdate').val(),
avatar:$('#join_avatar').val(),
phone:$('#login_phone').val(),
lat:$('#join_lat').val(),
......@@ -115,12 +116,12 @@ var join = {
}
}
});
}
},
step: function(step)
{
if(join.currentStep >= step || join.stepCheck(step))
{
switch(step)
......@@ -128,11 +129,11 @@ var join = {
case 2:
join.loadMap();
break;
default:
break;
}
$('.step').hide();
$('.step'+step).show();
$('.linklist.join li').removeClass('active').children('a').children('i').remove();
......@@ -157,7 +158,7 @@ var join = {
return false;
check = false;
}
if(!checkEmail($('#login_email').val()))
{
pulseError('Mit Deiner E-Mail-Adresse stimmt etwas nicht');
......@@ -165,7 +166,22 @@ var join = {
return false;
check = false;
}
let birthdate = new Date($('#birthdate').val());
let now = new Date();
let diff = now.getFullYear() - birthdate.getFullYear();
if(birthdate.getMonth() > now.getMonth()) {
diff--;
} else {
if(birthdate.getMonth() == now.getMonth()) {
if (birthdate.getDay() > now.getDay())
diff--;
}
}
if(diff<18) {
pulseInfo('Aus datenschutz- und haftungsrechtlichen Gründen musst du mindestens 18 Jahre alt sein, um bei foodsharing.de mitzumachen.')
return false;
}
if($('#login_passwd1').val().length < 4) // || $('#login_passwd1').val() != $('#login_passwd2').val())
{
pulseInfo('Dein Passwort muss länger als 4 Buchstaben sein');
......@@ -173,7 +189,7 @@ var join = {
return false;
check = false;
}
if($('#login_passwd1').val() != $('#login_passwd2').val())
{
pulseInfo('Deine Passwörter stimmen nicht überein');
......@@ -181,14 +197,14 @@ var join = {
return false;
check = false;
}
if(join.isLoading)
{
pulseInfo('Bitte warte bis Dein Foto hochgeladen ist');
return false;
check = false;
}
if($('#join_avatar_error').val() == '0' && $('#join_avatar').val() == '')
{
if(!confirm('Du hast kein Foto hochgeladen. Beachte, dass ein passbildähnliches Foto benötigt wird, wenn du später auch als Foodsaver aktiv werden möchtest. Ohne Foto fortfahren?'))
......@@ -197,7 +213,7 @@ var join = {
check = false;
}
}
if(check)
{
return true;
......@@ -206,9 +222,9 @@ var join = {
{
return false;
}
break;
default:
return true;
break;
......
......@@ -14,6 +14,7 @@ $g_lang['contact_info'] = 'Kontaktinformationen';
$g_lang['legal_stuff'] = 'Rechtliches';
$g_lang['select_picture'] = 'Foto ausw&auml;hlen';
$g_lang['peer'] = 'Foodsharer';
$g_lang['geb_datum'] = 'Geburtsdatum';
$g_lang['organisation'] = 'Organisation';
$g_lang['login_phone'] = 'Telefonnummer';
$g_lang['login_location'] = 'Deine Adresse';
......@@ -36,6 +37,7 @@ $g_lang['error_name'] = 'Bitte gib einen Namen ein';
$g_lang['error_email'] = 'Mit Deiner E-Mail-Adresse stimmt etwas nicht';
$g_lang['error_passwd'] = 'Dein Passwort muss mindestens 5 und darf maximal 30 Zeichen haben';
$g_lang['error_image'] = 'Dein Foto konnte nicht hochgeladen werden';
$g_lang['error_birthdate'] = 'Aus datenschutz- und haftungsrechtlichen Gründen musst du mindestens 18 Jahre alt sein, um bei foodsharing.de mitzumachen.';
$g_lang['activation_success'] = '<strong>Aktivierung erfolgreich.</strong> Logge Dich jetzt Mit Deiner E-Mail-Adresse und Deinem gewählten Passwort ein.';
$g_lang['activation_failed'] = '<strong>Aktivierung fehlgeschlagen!</strong> Ist der eingegebene Link auch korrekt?';
......
var fsapp = {
init: function () {
if ($('#fslist').length > 0) {
$('#fslist a').click(function (ev) {
ev.preventDefault();
$this = $(this);
fsida = $this.attr('href').split('#');
fsid = parseInt(fsida[(fsida.length - 1)]);
fsapp.loadFoodsaver(fsid);
});
}
},
loadFoodsaver: function (foodsaver_id) {
ajreq('loadFoodsaver', {
app: 'foodsaver',
id: foodsaver_id,
bid: $('#appdata .bid').val()
});
},
refreshfoodsaver: function () {
ajreq('foodsaverrefresh', {
app: 'foodsaver',
bid: $('#appdata .bid').val()
});
},
delfromBezirk: function (foodsaver_id) {
if (confirm('Wirklich aus Bezirk löschen?')) {
ajreq('delfrombezirk', {
app: 'foodsaver',
bid: $('#appdata .bid').val(),
id: foodsaver_id
});
}
import '@/core'
import '@/globals'
import { ajreq, GET } from '@/script'
import $ from 'jquery'
const fsapp = {
init: function () {
if ($('#fslist').length > 0) {
$('#fslist a').click(function (ev) {
ev.preventDefault()
let fsida = $(this).attr('href').split('#')
let fsid = parseInt(fsida[(fsida.length - 1)])
fsapp.loadFoodsaver(fsid)
})
}
};
$(function () {
fsapp.init();
})
\ No newline at end of file
},
loadFoodsaver: function (foodsaverId) {
ajreq('loadFoodsaver', {
app: 'foodsaver',
id: foodsaverId,
bid: GET('bid')
})
},
refreshfoodsaver: function () {
ajreq('foodsaverrefresh', {
app: 'foodsaver',
bid: GET('bid')
})
},
delfromBezirk: function (foodsaverId) {
if (window.confirm('Wirklich aus Bezirk löschen?')) {
ajreq('delfrombezirk', {
app: 'foodsaver',
bid: GET('bid'),
id: foodsaverId
})
}
}
}
fsapp.init()
window.fsapp = fsapp
......@@ -44,6 +44,7 @@ class LoginModel extends Model
`name`,
`nachname`,
`anschrift`,
`geb_datum`,
`telefon`,
`newsletter`,
`geschlecht`,
......@@ -65,6 +66,7 @@ class LoginModel extends Model
' . $this->strval($data['name']) . ',
' . $this->strval($data['surname']) . ',
' . $this->strval($data['str'] . ' ' . trim($data['nr'])) . ',
' . $this->strval($data['birthdate']) . ',
' . $this->strval($data['phone']) . ',
' . $this->intval($data['newsletter']) . ',
' . $this->intval($data['gender']) . ',
......
......@@ -76,14 +76,17 @@ class LoginView extends View
<div class="element-wrapper">
<input placeholder="' . $this->func->s('login_passwd2') . '" type="password" value="" id="login_passwd2" name="login_passwd1" class="input text value" />
</div>
<div class="element-wrapper">
<input type="date" id="birthdate" min="' . date('Y-m-d', strtotime('-120 years')) . '" max="' . date('Y-m-d', strtotime('-18 years')) . '" required />
<label for="birthdate">' . $this->func->s('geb_datum') . '</label>
</div>
</div>
<div class="avatar">
<form action="/xhrapp.php?app=login&m=photoupload" id="join_photoform" target="join_upload_frame" method="post" enctype="multipart/form-data">
<input type="hidden" name="action" value="upload" />
<a onclick="$(\'#join_photo\').trigger(\'click\');return false;" class="container corner-all" href="#">
<span class="mega-octicon octicon-device-camera"></span>
<span class="fa fa-circle-o-notch fa-spin"></span>
<span class="fa fa-circle-o-notch fa-spin"></span>
</a><br />
<a onclick="$(\'#join_photo\').trigger(\'click\');return false;" href="#" class="button">' . $this->func->s('select_picture') . '</a><span class="filewrapper"><input onchange="join.startUpload();" type="file" name="photo" id="join_photo" /></span>
</form>
......
......@@ -240,7 +240,13 @@ class LoginXhr extends Control
if ($data['gender'] > 2 || $data['gender'] < 0) {
$data['gender'] = 0;
}
$birthdate = \DateTime::createFromFormat('Y-m-d', $data['birthdate']);
$min_birthdate = new \DateTime();
$min_birthdate->modify('-18 years');
if (!$birthdate || $birthdate > $min_birthdate) {
return $this->func->s('error_birthdate');
}
$data['birthdate'] = $birthdate->format('Y-m-d');
$data['phone'] = $this->format_phone_number($data['phone']);
$data['lat'] = floatval($data['lat']);
$data['lon'] = floatval($data['lon']);
......
......@@ -15,6 +15,7 @@ class RegisterCest
$this->first_name = sq('first_name');
$this->last_name = sq('last_name');
$this->password = sq('password');
$this->birthdate = '1991-04-27';
}
public function _after()
......@@ -44,6 +45,8 @@ class RegisterCest
$I->fillField('login_name', $this->first_name);
$I->fillField('login_surname', $this->last_name);
$I->fillField('login_email', $this->email);
/* workaround because chromedriver fails to fill a date field... */
$I->executeJS("document.querySelector('#birthdate').value = '" . $this->birthdate . "'");
$I->fillField('#login_passwd1', $this->password);
$I->fillField('#login_passwd2', $this->password);
$I->click('weiter', '.step.step1');
......@@ -86,6 +89,7 @@ class RegisterCest
'email' => $this->stripped_email,
'name' => $this->first_name,
'nachname' => $this->last_name,
'geb_datum' => $this->birthdate,
'newsletter' => 0
]);
}
......
......@@ -8,6 +8,7 @@ $email = sq('email') . '@test.com';
$first_name = sq('first_name');
$last_name = sq('last_name');
$pass = sq('pass');
$birthdate = '1990-05-31';
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
......@@ -19,6 +20,7 @@ $I->sendPOST('/xhrapp.php?app=login&m=joinsubmit', [
'phone' => '39833',
'pw' => $pass,
'gender' => 0,
'birthdate' => $birthdate,
'newsletter' => 1
]);
......@@ -31,7 +33,7 @@ $I->seeInDatabase('fs_foodsaver', [
'name' => $first_name,
'nachname' => $last_name,
'newsletter' => 1,
'geb_datum' => $birthdate,
'passwd' => null, // no md5 password
'fs_password' => null, // no sha1 password
]);
......
......@@ -57,10 +57,6 @@
<style type="text/css">{{ head.css | raw }}</style>
<script type="text/javascript">
var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-43313114-1']); _gaq.push(['_setDomainName', '{{ HTTP_HOST }}']); _gaq.push(['_trackPageview']); (function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();
</script>
{% if not webpack %}
<script type="text/javascript">
{{ head.jsFunc | raw }}
......
......@@ -28,7 +28,7 @@
<input type="hidden" name="hosted_button_id" value="CLPZCSCKGNXE4">
<input type="image" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="Jetzt einfach, schnell und sicher online spenden – mit PayPal.">
<input type="image" src="/img/btn_donateCC_LG.gif" border="0" name="submit" alt="Jetzt einfach, schnell und sicher online spenden – mit PayPal.">
</form>
</div>
......
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