Stats events with additional dimensions
<?php
namespace CherrycakeApp;
class StatsEventUserLogin extends \Cherrycake\Stats\StatsEvent {
protected $timeResolution = \Cherrycake\Stats\STATS_EVENT_TIME_RESOLUTION_DAY;
protected $typeDescription = "User login";
}function doLogin($request) {
global $e;
$result = $e->Login->doLogin($request->email, $request->password);
if (
$result == \Cherrycake\Login\LOGIN_RESULT_FAILED_UNKNOWN_USER
||
$result == \Cherrycake\Login\LOGIN_RESULT_FAILED_WRONG_PASSWORD
) {
$e->Output->setResponse(new \Cherrycake\Actions\ResponseTextHtml([
"code" => \Cherrycake\Output\RESPONSE_OK,
"payload" => $e->HtmlDocument->header()."Login error".$e->HtmlDocument->footer()
]));
}
else {
$e->Stats->trigger(new StatsEventUserLogin);
$e->Output->setResponse(new \Cherrycake\Actions\Response([
"code" => \Cherrycake\Outut\RESPONSE_REDIRECT_FOUND,
"url" => $e->Actions->getAction("loginGuideHome")->request->buildUrl()
]));
}
}Last updated