Luca01 Posted July 2, 2018 Share Posted July 2, 2018 Hallo Foris, ich bastel ein bisschen rum und dabei habe ich einen Override für den AdminLoginController.php gebaut. Die kleine Ergänzung veschickt eine Mail an die Shop-Mailadresse wenn sich jemand in das Backoffice einloggt. Und hier ... is'a <?php /** * eMail bei Login ins Backoffice * * @category Admincontroller * @author Luca * @support Luca * @copyright 2018 Luca * @version 1.0.0 * @link https://www.holzladen24.de * @license open source */ class AdminLoginController extends AdminLoginControllerCore { public function processLogin() { /* Check fields validity */ $passwd = trim(Tools::getValue('passwd')); $email = trim(Tools::getValue('email')); /*Anfang --- E-Mail an mich wenn sich jemand einloggt*/ $id_shop = Context::getContext()->shop->id; $vars = array( '{firstname}' => (string) Configuration::get('PS_SHOP_NAME', null, null, $id_shop).' gerade hat sich ', '{lastname}' => $email.' eingeloggt', '{reply}' => 'Es ist '.date('d.m.Y H:i:s').' und '.$email.' hat sich ins Backoffice eingeloggt.', '{link}' => $email, ); $shop_mail = (string) Configuration::get('PS_SHOP_EMAIL', null, null, $id_shop); Mail::Send($this->context->language->id,'reply_msg','BO-Login von '.$email,$vars,$shop_mail,Configuration::get('PS_SHOP_NAME', null, null, $id_shop)); /*Ende --- E-Mail an mich wenn sich jemand einloggt*/ if (empty($email)) { $this->errors[] = $this->trans('Email is empty.', array(), 'Admin.Notifications.Error'); } elseif (!Validate::isEmail($email)) { $this->errors[] = $this->trans('Invalid email address.', array(), 'Admin.Notifications.Error'); } if (empty($passwd)) { $this->errors[] = $this->trans('The password field is blank.', array(), 'Admin.Notifications.Error'); } elseif (!Validate::isPasswd($passwd)) { $this->errors[] = $this->trans('Invalid password.', array(), 'Admin.Notifications.Error'); } if (!count($this->errors)) { // Find employee $this->context->employee = new Employee(); $is_employee_loaded = $this->context->employee->getByEmail($email, $passwd); $employee_associated_shop = $this->context->employee->getAssociatedShops(); if (!$is_employee_loaded) { $this->errors[] = $this->trans('The employee does not exist, or the password provided is incorrect.', array(), 'Admin.Login.Notification'); $this->context->employee->logout(); } elseif (empty($employee_associated_shop) && !$this->context->employee->isSuperAdmin()) { $this->errors[] = $this->trans('This employee does not manage the shop anymore (either the shop has been deleted or permissions have been revoked).', array(), 'Admin.Login.Notification'); $this->context->employee->logout(); } else { PrestaShopLogger::addLog($this->trans('Back office connection from %ip%', array('%ip%' => Tools::getRemoteAddr()), 'Admin.Advparameters.Feature'), 1, null, '', 0, true, (int)$this->context->employee->id); $this->context->employee->remote_addr = (int)ip2long(Tools::getRemoteAddr()); // Update cookie $cookie = Context::getContext()->cookie; $cookie->id_employee = $this->context->employee->id; $cookie->email = $this->context->employee->email; $cookie->profile = $this->context->employee->id_profile; $cookie->passwd = $this->context->employee->passwd; $cookie->remote_addr = $this->context->employee->remote_addr; if (!Tools::getValue('stay_logged_in')) { $cookie->last_activity = time(); } $cookie->write(); // If there is a valid controller name submitted, redirect to it if (isset($_POST['redirect']) && Validate::isControllerName($_POST['redirect'])) { $url = $this->context->link->getAdminLink($_POST['redirect']); } else { $tab = new Tab((int)$this->context->employee->default_tab); $url = $this->context->link->getAdminLink($tab->class_name); } if (Tools::isSubmit('ajax')) { die(json_encode(array('hasErrors' => false, 'redirect' => $url))); } else { $this->redirect_after = $url; } } } if (Tools::isSubmit('ajax')) { die(json_encode(array('hasErrors' => true, 'errors' => $this->errors))); } } } Viele Grüße Luca Link to comment Share on other sites More sharing options...
eleazar Posted July 5, 2018 Share Posted July 5, 2018 Hey, das ist ja mal eine Überraschung. Du hast dich ja hier schon lang nicht mehr geäußert, Luca. Thanks for sharing. Glückwunsch zu deinem farblich ansprechenden 1.6er-Shop; der lädt mit seinem beeindruckenden Angebot wirklich zu Stöbern ein. Mir gefällt auch das Faxformular - gute Idee! Gibt es da auch vielleicht noch ein Code-Stückchen zu? 😊 Aber schau dir nochmal in deinem Shop die Geschenkideen an. In der Vertikalansicht (ich habe gerade nur ein Tablet zur Hand) der Produktliste schießt die Kategoriebeschreibung über den vorgesehenen Hintergrundrahmen hinaus. Das liegt vermutlich an der rechts daneben starr plazierten Grafik mit den Eurostücken. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now