/** * Adds Task for updating user email * @param User $user * @return bool */ public function onConfirmEmailComplete(\User $oUser) { /* Get and run the task */ $oUserHelper = $this->getUserHelper(); $task = $oUserHelper->getUpdateUserTask(); $task->call('updateUserEmail', $oUser->getId(), $oUser->getEmail()); $task->queue(); return true; }
public function editUser(User $user) { $STH = $this->DBH->prepare("UPDATE Users SET login=:login, email=:email, password=:password WHERE id=:id"); $STH->bindValue(":login", $user->getLogin()); $STH->bindValue(":email", $user->getEmail()); $STH->bindValue(":password", $user->getPassword()); $STH->bindValue(":id", $user->getID()); $STH->execute(); }
public function login($POST) { $db = new DB(); $user = new User(); $user->setEmail($POST["email"]); $user->setPassword($POST["password"]); if ($user->getEmail() == "") { $response["status"] = 1; $response["msg"] = "กรุณากรอก Email"; } else { if ($user->getPassword() == "") { $response["status"] = 2; $response["msg"] = "กรุณากรอก Password"; } else { $array = array("email" => array("type" => $user->getDataType("email"), "value" => $user->getEmail()), array("type" => $user->getDataType("password"), "value" => $user->getPassword())); $sql = "SELECT * FROM users WHERE email = ? AND password = ?"; $data = $db->query($sql, $array); if (count($data) > 0) { $response["status"] = 0; $response["msg"] = "Success"; } else { $response["status"] = -1; $response["msg"] = "ไม่พบ Email/Password นี้ในระบบ"; } } } echo json_encode($response); }
public function testEmail() { $emailTest = "*****@*****.**"; $this->assertEmpty($this->user->getEmail()); $this->user->setEmail($emailTest); $this->assertEquals($emailTest, $this->user->getEmail()); }
/** * @inheritdoc */ public function getEmail() { $knownEmail = $this->user->getEmail(); if (!empty($knownEmail)) { return $knownEmail; } return $this->email; }
/** * @param string $email * @return bool */ private function setEmail($email) { if ($this->user->getEmail() !== $email) { $this->user->setEmail($email); return true; } return false; }
public function createResetToken(User $user) { ResultHelper::whenEmpty($user->getEmail(), AppLabelUtil::$ERROR_USER_NO_EMAIL, HttpStatusCode::internalServerError()); $tokenHash = Hash::create("sha256", mcrypt_create_iv(64, MCRYPT_DEV_URANDOM), HASH_GENERAL_KEY); $this->mailService->setMailHeading(array($user->getEmail() => $user->getFirstName() . " " . $user->getLastName())); $this->mailService->setBody("Instellen van uw wachtwoord", "Beste gebruiker, gelieve de volgende link te gebruiken om uw wachtwoord in te stellen: " . URL . "#/reset/token/" . $tokenHash); $this->mailService->sendMail(); $resetToken = $this->resetTokenFactory->createResetToken($user->getId(), $tokenHash); $this->resetTokenDao->create($resetToken); }
public function testUpdate() { $this->entityManager->persist($this->user); $this->entityManager->flush(); $this->user->setUsername("Jorge Fernandez"); $this->user->setRoles(['ROLE_MANAGER', 'ROLE_ADMIN', 'ROLE_SUPER_ADMIN']); $this->entityManager->persist($this->user); $this->entityManager->flush(); $persistedUser = $this->userRepository->findOneBy(["email" => $this->user->getEmail()]); $this->assertEquals($this->user, $persistedUser); $this->assertEquals($this->user->getRoles(), $persistedUser->getRoles()); }
function set2(User $user) { //Update de todos los campos menos el id, el id se usara como el where para el update numero de filas modificadas $parametrosSet = array(); $parametrosSet['email'] = $user->getEmail(); $parametrosSet['clave'] = $user->getClave(); $parametrosSet['alias'] = $user->getAlias(); $parametrosSet['fechaAlta'] = $user->getFechaAlta(); $parametrosSet['activo'] = $user->getActivo(); $parametrosWhere = array(); $parametrosWhere["email"] = $user->getEmail(); return $this->bd->update($this->tabla, $parametrosSet, $parametrosWhere); }
function email_notify($check,$check_result,$subscription) { global $status_array; $user = new User($subscription->getUserId()); echo 'email plugin!'; $email = new fEmail(); // This sets up fSMTP to connect to the gmail SMTP server // with a 5 second timeout. Gmail requires a secure connection. $smtp = new fSMTP('smtp.gmail.com', 465, TRUE, 5); $smtp->authenticate('*****@*****.**', 'example'); $email->addRecipient($user->getEmail(), $user->getUsername()); // Set who the email is from $email->setFromEmail('*****@*****.**','Tattle'); // Set the subject include UTF-8 curly quotes $email->setSubject('Tattle : Alert for ' . $check->prepareName()); // Set the body to include a string containing UTF-8 $state = $status_array[$check_result->getStatus()]; $email->setHTMLBody("<p>$state Alert for {$check->prepareName()} </p><p>The check returned {$check_result->prepareValue()}</p><p>Warning Threshold is : ". $check->getWarn() . "</p><p>Error Threshold is : ". $check->getError() . '</p><p>View Alert Details : <a href="' . $fURL::getDomain() . '/' . CheckResult::makeURL('list',$check_result) . '">'.$check->prepareName()."</a></p>"); $email->setBody(" $state Alert for {$check->prepareName()} The check returned {$check_result->prepareValue()} Warning Threshold is : ". $check->getWarn() . " Error Threshold is : ". $check->getError() . " "); try { $message_id = $email->send($smtp); } catch ( fConnectivityException $e) { fCore::debug("email send failed",FALSE); } }
/** * Store User authentication data in session * * Also regenerates session id to prevent session fixation * * @param User $user */ public function signIn(User $user) { $_SESSION['HTTP_USER_AGENT'] = $_SERVER['HTTP_USER_AGENT']; $userArray = ['id' => $user->getId(), 'email' => $user->getEmail(), 'role' => $user->getRole()]; $_SESSION['User'] = serialize($userArray); session_regenerate_id(true); }
/** * Checks a User object for a blacklisted email address * * @param User $user * @return bool True on valid email */ public function checkUser(User $user) { $blacklists = $this->getBlacklists(); $whitelists = $this->getWhitelists(); // The email to check $email = $user->getEmail(); if (!count($blacklists)) { // Nothing to check return true; } // Check for whitelisted email addresses if (is_array($whitelists)) { wfDebugLog('SpamBlacklist', "Excluding whitelisted email addresses from " . count($whitelists) . " regexes: " . implode(', ', $whitelists) . "\n"); foreach ($whitelists as $regex) { if (preg_match($regex, $email)) { // Whitelisted email return true; } } } # Do the match wfDebugLog('SpamBlacklist', "Checking e-mail address against " . count($blacklists) . " regexes: " . implode(', ', $blacklists) . "\n"); foreach ($blacklists as $regex) { if (preg_match($regex, $email)) { return false; } } return true; }
/** * Generate the generic "this page has been changed" e-mail text. */ protected function composeCommonMailtext() { global $wgPasswordSender, $wgPasswordSenderName, $wgNoReplyAddress; global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress; global $wgEnotifUseRealName, $wgRequest; $this->composed_common = true; if ($this->editor->isAnon()) { $pageEditor = wfMsgForContent('enotif_anon_editor', $this->editor->getName()); } else { $pageEditor = $wgEnotifUseRealName ? $this->editor->getRealName() : $this->editor->getName(); } // build the subject $this->subject = wfMessage('moodbar-enotif-subject')->params($pageEditor)->escaped(); // build the body $targetUserName = $this->targetUser->getName(); $links = $this->buildEmailLink(); //text version, no need to escape since client will interpret it as plain text $textBody = wfMessage('moodbar-enotif-body')->params($targetUserName, $links['feedbackPageUrl'], $links['editorTalkPageUrl'], $this->response, $links['targetUserTalkPageUrl'], $pageEditor)->text(); //html version, this is a little bit ugly as we have to make wiki link clickable in emails $action = $wgRequest->getVal('action'); $wgRequest->setVal('action', 'render'); $htmlBody = wfMsgExt('moodbar-enotif-body', array('parse'), $targetUserName, $links['feedbackPageUrl'], $links['editorTalkPageUrl'], '<div style="margin-left:20px; margin-right:20px;">"' . $this->response . '"</div>', $links['targetUserTalkPageUrl'], $pageEditor); $wgRequest->setVal('action', $action); // assemble the email body $this->body = <<<HTML --{$this->mime_boundary} Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit {$textBody} --{$this->mime_boundary} Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit <html> \t<body> \t\t{$htmlBody} \t</body> </html> --{$this->mime_boundary}-- HTML; # Reveal the page editor's address as REPLY-TO address only if # the user has not opted-out and the option is enabled at the # global configuration level. $adminAddress = new MailAddress($wgPasswordSender, $wgPasswordSenderName); if ($wgEnotifRevealEditorAddress && $this->editor->getEmail() != '' && $this->editor->getOption('enotifrevealaddr')) { $editorAddress = new MailAddress($this->editor); if ($wgEnotifFromEditor) { $this->from = $editorAddress; } else { $this->from = $adminAddress; $this->replyto = $editorAddress; } } else { $this->from = $adminAddress; $this->replyto = new MailAddress($wgNoReplyAddress); } }
public function testGetEmail() { $this->User->setEmail('*****@*****.**'); if ($this->User->getEmail() != '*****@*****.**') { $this->fail(); } }
function email_plugin_notify_master($check, $check_result, $subscription, $alt_email = false) { global $status_array; $user = new User($subscription->getUserId()); $email = new fEmail(); // This sets up fSMTP to connect to the gmail SMTP server // with a 5 second timeout. Gmail requires a secure connection. $smtp = new fSMTP(sys_var('smtp_server'), sys_var('smtp_port'), sys_var('require_ssl') === 'true' ? TRUE : FALSE, 5); if (sys_var('require_auth') === 'true') { $smtp->authenticate(sys_var('smtp_user'), sys_var('smtp_pass')); } if ($alt_email) { $email_address = usr_var('alt_email', $user->getUserId()); } else { $email_address = $user->getEmail(); } $email->addRecipient($email_address, $user->getUsername()); // Set who the email is from $email->setFromEmail(sys_var('email_from'), sys_var('email_from_display')); $state = $status_array[$check_result->getStatus()]; // Set the subject include UTF-8 curly quotes if ($state == 'OK') { $email->setSubject(str_replace('{check_name}', $check->prepareName(), sys_var('email_end_alert_subject'))); } else { $email->setSubject(str_replace('{check_name}', $check->prepareName(), sys_var('email_subject'))); } // Set the body to include a string containing UTF-8 $check_type = ''; if ($check->getType() == 'threshold') { $check_type = ' Threshold'; } elseif ($check->getType() == 'predictive') { $check_type = ' Standard Deviation'; } $state_email_injection = $state . " Alert "; if ($state == 'OK') { $state_email_injection = "Everything's back to normal "; } // Remind : ('0' => 'OK', '1' => 'Error', '2' => 'Warning'); $state_int = $check_result->getStatus(); if ($state_int == 0) { $color = "green"; } else { if ($state_int == 2) { $color = "orange"; } else { $color = "red"; } } $html_body = "<p style='color:" . $color . ";'>" . $state_email_injection . "for {$check->prepareName()} </p>" . "<p>The check returned {$check_result->getValue()}</p>" . "<p>Warning" . $check_type . " is : " . $check->getWarn() . "</p>" . "<p>Error" . $check_type . " is : " . $check->getError() . "</p>" . "<p>View Alert Details : <a href='" . $GLOBALS['TATTLE_DOMAIN'] . '/' . CheckResult::makeURL('list', $check_result) . "'>" . $check->prepareName() . "</a></p>"; $email->setHTMLBody($html_body); $email->setBody("\n {$state} Alert for {$check->prepareName()}\nThe check returned {$check_result->getValue()}\nWarning" . $check_type . " is : " . $check->getWarn() . "\nError" . $check_type . " is : " . $check->getError() . "\n "); try { $message_id = $email->send($smtp); } catch (fConnectivityException $e) { fCore::debug($e, FALSE); fCore::debug("email send failed", FALSE); $e->printMessage(); $e->printTrace(); } }
public function present(User $user) { $name = $this->presentName($user->getName()); $email = $this->presentEmail($user->getEmail()); $password = $this->presentPassword($user->getPassword()); return join('', ['Your name is: ', $name, PHP_EOL, 'Your email is: ', $email, PHP_EOL, 'Your password is: ', $password, PHP_EOL]); }
function email_plugin_notify($check,$check_result,$subscription,$alt_email=false) { global $status_array; $user = new User($subscription->getUserId()); $email = new fEmail(); // This sets up fSMTP to connect to the gmail SMTP server // with a 5 second timeout. Gmail requires a secure connection. $smtp = new fSMTP(sys_var('smtp_server'), sys_var('smtp_port'), TRUE, 5); $smtp->authenticate(sys_var('smtp_user'), sys_var('smtp_pass')); if ($alt_email) { $email_address = usr_var('alt_email',$user->getUserId()); } else { $email_address = $user->getEmail(); } $email->addRecipient($email_address, $user->getUsername()); // Set who the email is from $email->setFromEmail(sys_var('email_from'), sys_var('email_from_display')); // Set the subject include UTF-8 curly quotes $email->setSubject(str_replace('{check_name}', $check->prepareName(), sys_var('email_subject'))); // Set the body to include a string containing UTF-8 $state = $status_array[$check_result->getStatus()]; $email->setHTMLBody("<p>$state Alert for {$check->prepareName()} </p><p>The check returned {$check_result->prepareValue()}</p><p>Warning Threshold is : ". $check->getWarn() . "</p><p>Error Threshold is : ". $check->getError() . '</p><p>View Alert Details : <a href="' . fURL::getDomain() . '/' . CheckResult::makeURL('list',$check_result) . '">'.$check->prepareName()."</a></p>"); $email->setBody(" $state Alert for {$check->prepareName()} The check returned {$check_result->prepareValue()} Warning Threshold is : ". $check->getWarn() . " Error Threshold is : ". $check->getError() . " "); try { $message_id = $email->send($smtp); } catch ( fConnectivityException $e) { fCore::debug("email send failed",FALSE); } }
public function initTable() { $adminConf = getConfigFile(); $query = $this->db->prepare("INSERT INTO user(UserName,Mdp,DateInscription,email,Tel) VALUES (:username , :mdp , NOW() , :email , :tel);\n INSERT INTO user_droit(id_Droits, id_User, Date) VALUES (1,1,NOW());"); $admin = new User(array("UserName" => $adminConf['pseudo'], "Mdp" => "admin", "email" => $adminConf['mail'], "tel" => $adminConf['tel'])); $admin->setHashMdp(); $query->execute(array(":username" => $admin->getUserName(), ":mdp" => $admin->getMdp(), ":email" => $admin->getEmail(), ":tel" => $admin->getTel())); }
public static function validate(User $User) { $errors = array(); if (!trim($User->getEmail())) { $errors[] = new Error('email', 'email address cannot be empty.'); } return $errors; }
/** * Generate, store, and return a new e-mail confirmation code. * A hash (unsalted since it's used as a key) is stored. * @param User $user * @param string $expiration * @return string */ public static function getConfirmationToken($user, &$expiration) { global $wgConfirmAccountRejectAge; $expires = time() + $wgConfirmAccountRejectAge; $expiration = wfTimestamp(TS_MW, $expires); $token = $user->generateToken($user->getName() . $user->getEmail() . $expires); return $token; }
public function createUser(User $user) { $user->setId(null); $sql = ' INSERT INTO users_tb(id,email, user_password) VALUES (:id,:email,:user_password)'; $params = array(':id' => $user->getId(), ':email' => $user->getEmail(), ':user_password' => $user->getPassword()); return $this->execute($sql, $user, $params); }
/** * Send welcome message * * @param void * @return null */ function send_welcome_message() { if ($this->active_user->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_user->canSendWelcomeMessage($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if $this->skip_layout = $this->request->isAsyncCall(); $welcome_message_data = $this->request->post('welcome_message'); if (!is_array($welcome_message_data)) { $welcome_message_data = array('message' => UserConfigOptions::getValue('welcome_message', $this->active_user)); } // if $this->smarty->assign('welcome_message_data', $welcome_message_data); if ($this->request->isSubmitted()) { $welcome_message = trim(array_var($welcome_message_data, 'message')); if ($welcome_message) { UserConfigOptions::setValue('welcome_message', $welcome_message, $this->active_user); } else { UserConfigOptions::removeValue('welcome_message', $this->active_user); } // if $password = make_password(11); $this->active_user->setPassword($password); $save = $this->active_user->save(); if ($save && !is_error($save)) { $welcome_message_sent = ApplicationMailer::send(array($this->active_user), 'system/new_user', array('created_by_id' => $this->logged_user->getId(), 'created_by_name' => $this->logged_user->getDisplayName(), 'created_by_url' => $this->logged_user->getViewUrl(), 'email' => $this->active_user->getEmail(), 'password' => $password, 'login_url' => assemble_url('login'), 'welcome_body' => $welcome_message ? nl2br(clean($welcome_message)) : '')); if ($welcome_message_sent) { $message = lang('Welcome message has been sent to :name', array('name' => $this->active_user->getDisplayName())); } else { $message = lang('Failed to send welcome message to :name. Please try again later', array('name' => $this->active_user->getDisplayName())); } // if if ($this->request->isAsyncCall()) { die($message); } else { flash_success($message); $this->redirectToUrl($this->active_user->getViewUrl()); } // if } else { if ($this->request->isAsyncCall()) { $this->httpError(HTTP_ERR_OPERATION_FAILED); } else { flash_error($message); $this->redirectToUrl($this->active_user->getViewUrl()); } // if } // if } // if }
function getBiographicalFeature(User $user, $feature) { switch ($feature) { case "name": $feat_str = $user->getName("%f %l"); break; case "group": $feat_str = $user->getGroup(); break; case "role": $feat_str = $user->getRole(); break; case "photo": $official_photo = UserPhoto::get($user->getID(), UserPhoto::OFFICIAL); $feat_str = $official_photo->getFilename(); break; case "organisation": $organisation = $user->getOrganisation(); $feat_str = $organisation->getTitle(); break; case "email": $feat_str = $user->getEmail(); break; case "email_alt": $feat_str = $user->getEmailAlternate(); break; case "address": $address = $user->getAddress(); $postcode = $user->getPostalCode(); $city = $user->getCity(); $province = $user->getProvince(); $prov_name = $province->getName(); $country = $user->getCountry(); $country_name = $country->getName(); $feat_str = html_encode($address) . "<br />" . html_encode($city); if ($prov_name) { $feat_str .= ", " . html_encode($prov_name); } $feat_str .= "<br />"; $feat_str .= html_encode($country_name); if ($postcode) { $feat_str .= ", " . html_encode($postcode); } break; case "phone": $feat_str = $user->getTelephone(); break; case "fax": $feat_str = $user->getFax(); break; default: Zend_Debug::dump($feature); return; } return $feat_str; }
/** * AbortNewAccount hook * * @param User $user */ public static function abortNewAccount($user, &$message) { global $wgUser; $blacklisted = EmailBlacklist::singleton()->userCannot($user->getEmail(), $wgUser); if ($blacklisted instanceof EmailBlacklistEntry) { $message = wfMessage($blacklisted->getErrorMessage())->parse(); return false; } return true; }
private function sendUserResetCode(User $user) { $fullname = $user->getFullname(); $email = $user->getEmail(); $code = $user->getVerificationCode(); $message = "Dear {$fullname}, <br> " . "\t The account verification code requested by you as be sent , please if this is you continue with the process. " . "<br>Account email : {$email}<br><br> " . "<br>Reset code : {$code}<br><br>" . "Copy and paste the reset code on the field provided in your application screen "; // send the code to the user throw email or text message $mailer = new TrySendEmail($message, ADMINISTRATOR_EMAIL, $email, $fullname); return $mailer->update(); }
public function __construct() { $this->view = ViewManager::getInstance(); // get the current user and put it to the view if (session_status() == PHP_SESSION_NONE) { session_start(); } //inicializa la variable $this->friendDAO = new FriendDAO(); if (isset($_SESSION["currentuser"])) { //En la sesion de currentuser se encuentra todo el usuario //ya que al hacer el login se introdujo todo el usuario en la sesion $this->currentUser = $_SESSION["currentuser"]; $this->view->setVariable("currentusername", $this->currentUser); //consigue el numero total de solicitudes de amistad $numSolicitudes = $this->friendDAO->getNumSolicitudes($this->currentUser->getEmail()); //Carga el num solicitudes en la vista $this->view->setVariable("numSolicitudes", $numSolicitudes); } }
public function checkEmail($email) { if (filter_var($email, FILTER_VALIDATE_EMAIL) === true) { $userEmail = User::getEmail(); if ($userEmail !== $email) { $email = true; } else { return false; } } }
public function updateUser(User $user) { $existingUser = $this->getUserById($user->getId()); if ($user->getRole()->getId() != $existingUser->getRole()->getId() && $this->isRootUser($existingUser)) { throw new AemosRestException(AppLabelUtil::$ERROR_USER_IS_ROOT, HttpStatusCode::badRequest()); } ResultHelper::whenEmpty($user->getUsername(), AppLabelUtil::$ERROR_USER_INCOMPLETE, HttpStatusCode::badRequest()); ResultHelper::whenEmpty($user->getEmail(), AppLabelUtil::$ERROR_USER_INCOMPLETE, HttpStatusCode::badRequest()); ResultHelper::whenEmpty($user->getRole(), AppLabelUtil::$ERROR_USER_INCOMPLETE, HttpStatusCode::badRequest()); $this->userDao->update($user); }
public function addUser(User $User) { $userid = $User->getUserid(); $userpass = $User->getUserpassword(); $email = $User->getEmail(); $telnum = $User->getTelno(); $firstname = $User->getFirstname(); $lastname = $User->getLastname(); $previlege = $User->getPrivilege(); $add = mysql_query("insert into user (`UserId`, `UserPassword`, `emaill`, `TelNum`, `FirstName`, `LastName`, `Privilege_id`) values ('{$userid}','{$userpass}','{$email}','{$telnum}','{$firstname}','{$lastname}','{$previlege}')"); }
public function findUserByEmail(User $user) { $result = array(); $email = $user->getEmail(); $sql = 'SELECT id FROM users_tb WHERE ' . 'email = "' . $email . '";'; foreach ($this->query($sql) as $row) { $user = new User(); UserMapper::map($user, $row); } return $user->getId(); }