From 6854cb3f4d8219cf1829e32122eb2502a916eae9 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 1 Feb 2020 09:05:48 +0100 Subject: initial checkin --- js/callbacks/testemail.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 js/callbacks/testemail.php (limited to 'js/callbacks/testemail.php') diff --git a/js/callbacks/testemail.php b/js/callbacks/testemail.php new file mode 100644 index 0000000..788a12f --- /dev/null +++ b/js/callbacks/testemail.php @@ -0,0 +1,44 @@ +check_account_ok(); +} else { + $user = new User(0, $proj); +} + +// don't allow anonymous users to access this page at all +if ($user->isAnon()) { + die(L('nopermission')); +} +load_translations(); + +if( !Post::has('csrftoken') ){ + http_response_code(428); # 'Precondition Required' + die('missingtoken'); +}elseif( Post::val('csrftoken')==$_SESSION['csrftoken']){ + # empty +}else{ + http_response_code(412); # 'Precondition Failed' + die('wrongtoken'); +} +if (!$user->perms('is_admin')){ + http_response_code(403); # 'Forbidden' + die(L('nopermission')); +} + +$notify = new Notifications; +$result=$notify->sendEmail($user->infos['email_address'],'test','testcontent',1); + +if($result !=1){ + http_response_code(406); # 'Not Acceptable' +} +echo 'ok'; +?> -- cgit v1.2.3-70-g09d2