Skip to content
Code-Schnipsel Gruppen Projekte
Commit 32125ce3 erstellt von Florian Bogner's avatar Florian Bogner
Dateien durchsuchen

feat: The user can now cancel the registration process

Übergeordneter 1c665dd5
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
<?php
/**
* Requests the server to cancel the registration
*
* @param - The email which was used for registration.
*/
QUI::$Ajax->registerFunction(
'package_quiqqer_cron_ajax_cronservice_cancelRegistration',
function () {
$CronService = new \QUI\Cron\CronService();
$CronService->cancelRegistration();
},
array(),
''
);
.quiqqer-cron-cronservicewindow-btn-openRegistration {
margin : 30px auto 0 auto;
float : right;
margin : 30px auto 0 auto;
}
.quiqqer-cron-cronserviceWindow h2 {
......@@ -28,8 +28,8 @@
}
.quiqqer-cron-cronservicewindow-buttons {
text-align : center;
margin-top : 40px;
text-align : center;
width : 100%;
}
......@@ -71,16 +71,24 @@
}
.quiqqer-cron-cronservicewindow-registration-txt-email {
width : 100%;
margin-top : 6px;
width : 100%;
}
.quiqqer-cron-cronservicewindow-btn-register {
margin-top : 20px;
float : right;
margin-top : 20px;
}
.quiqqer-cron-cronservicewindow-registration-success-btn-confirm {
float : right;
margin : 15px 0 0 0;
}
.quiqqer-cron-cronservicewindow-registration-success-btn-cancel-text {
overflow : hidden;
text-align : center;
text-overflow : ellipsis;
white-space : nowrap;
width : 100%;
}
\ No newline at end of file
......@@ -108,9 +108,7 @@ define('package/quiqqer/cron/bin/CronServiceWindow', [
// Register/Unregister Button
if (self.status)
// Get the button text : register or unregister
{
if (self.status) {
var btnText = QUILocale.get(lg, 'cron.window.cronservice.content.btn.register');
}
if (self.registered) {
......@@ -119,20 +117,41 @@ define('package/quiqqer/cron/bin/CronServiceWindow', [
var Button = null;
if (self.status == 2) {
// Resend Activation Button
Button = new QUIButton({
text : QUILocale.get(lg, 'cron.window.cronservice.content.btn.resend.activation.mail'),
textimage: 'fa fa-envelope-o',
events : {
onClick: function (Button) {
onClick: function () {
self.resendActivationMail();
}
},
styles : {
'float': 'none',
margin : '0 auto',
width : 200
width : 'calc(50% - 5px)'
}
});
// Cancel Registration Button
new QUIButton({
text : '<span class="quiqqer-cron-cronservicewindow-registration-success-btn-cancel-text">' + QUILocale.get(lg, 'cron.window.cronservice.registration.button.text.cancel') + '</span>',
events: {
onClick: function (Button) {
Button.setAttribute('text', QUILocale.get('quiqqer/cron', 'cron.window.cronservice.content.btn.unregister.confirm'));
if (Button.getAttribute('clickcnt') == 1) {
self.cancelRegistration().then(function () {
self.refresh();
});
}
Button.setAttribute('clickcnt', 1);
}
},
styles: {
'float': 'none',
margin : '0 10px 0 0',
width : 'calc(50% - 5px)'
}
}).inject(Buttons);
} else {
Button = new QUIButton({
text : btnText,
......@@ -216,9 +235,12 @@ define('package/quiqqer/cron/bin/CronServiceWindow', [
}).inject(this.$Elm).show();
},
/**
* Shows the registration success sheet, which contains information about the activation email
*/
showRegistrationSuccess: function () {
var self = this;
new QUISheets({
header : true,
icon : 'fa fa-cloud',
......@@ -281,6 +303,23 @@ define('package/quiqqer/cron/bin/CronServiceWindow', [
});
},
/**
* Cancels the registration
* @returns {*}
*/
cancelRegistration: function () {
return new Promise(function (resolve, reject) {
QUIAjax.get('package_quiqqer_cron_ajax_cronservice_cancelRegistration', resolve, {
'package': lg,
onError : reject
});
});
},
/**
* Sends the activation mail again
* @returns {*}
*/
resendActivationMail: function () {
return new Promise(function (resolve, reject) {
QUIAjax.get('package_quiqqer_cron_ajax_cronservice_resendActivation', resolve, {
......
......@@ -448,5 +448,9 @@ This is works with an external server on which QUIQQER systems can register them
<de><![CDATA[Verstanden]]></de>
<en><![CDATA[Okay]]></en>
</locale>
<locale name="cron.window.cronservice.registration.button.text.cancel">
<de><![CDATA[Registrierung abbrechen]]></de>
<en><![CDATA[Cancel registration]]></en>
</locale>
</groups>
</locales>
\ No newline at end of file
......@@ -8,7 +8,7 @@ use QUI\System\Log;
class CronService
{
const CRONSERVICE_URL = "https://cron.quiqqer.com";
const CRONSERVICE_URL = "http://server.cronservice.flo.pcsg";
private $domain;
private $https;
......@@ -112,7 +112,6 @@ class CronService
*/
public function resendActivationMail()
{
if (!isset($this->domain) || empty($this->domain)) {
throw new Exception("Could not get the instances domain.");
}
......@@ -125,6 +124,24 @@ class CronService
);
}
/**
* Attempts to cancel the registration on the server
* @throws Exception
*/
public function cancelRegistration()
{
Log::addDebug("");
if (!isset($this->domain) || empty($this->domain)) {
throw new Exception("Could not get the instances domain.");
}
$this->makeServerAjaxCall(
"package_pcsg_cronservice_ajax_cancelRegistration",
array(
"domain" => $this->domain
)
);
}
/**
* Sends an ajax request to the cronservice server.
......@@ -277,4 +294,5 @@ class CronService
return $token;
}
}
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren