Esempio n. 1
0
 public function passwordResetAjax2()
 {
     ipRequest()->mustBePost();
     $validateForm = FormHelper::getPasswordResetForm2();
     $errors = $validateForm->validate(ipRequest()->getPost());
     $userId = ipRequest()->getPost('userId');
     $secret = ipRequest()->getPost('secret');
     $password = ipRequest()->getPost('password');
     try {
         \Ip\Internal\Administrators\Service::resetPassword($userId, $secret, $password);
     } catch (\Ip\Exception $e) {
         $user['global_error'] = $e->getMessage();
     }
     if (empty($errors)) {
         $answer = array('status' => 'success', 'redirectUrl' => ipActionUrl(array('sa' => 'Admin.passwordResetSuccess')));
     } else {
         $answer = array('status' => 'error', 'errors' => $errors);
     }
     $response = new \Ip\Response\Json($answer);
     return $response;
 }
Esempio n. 2
0
 public function setAdminLogin($username)
 {
     $administrator = \Ip\Internal\Administrators\Service::getByUsername($username);
     $ip = ipRequest()->getServer('REMOTE_ADDR');
     Backend::login($administrator['id']);
     ipEvent('ipAdminLoginSuccessful', array('username' => $username, 'id' => $administrator['id']));
     ipLog()->info('Admin.loggedIn: {username} from {ip}', array('username' => $username, 'ip' => $ip));
 }
Esempio n. 3
0
 public static function insertAdmin($user, $email, $pass)
 {
     $adminId = \Ip\Internal\Administrators\Service::add($user, $email, $pass);
     \Ip\Internal\AdminPermissionsModel::addPermission('Super admin', $adminId);
 }