コード例 #1
0
ファイル: UserControl.php プロジェクト: ttym7993/Linger
 /**
  * 发送邮件给新的邮箱地址
  * @param User   $user
  * @param string $email
  * @param string $password
  * @throws \Exception
  */
 public function edit_email_send_mail($user, $email, $password)
 {
     lib()->load('UserCheck', 'MailTemplate');
     $email = strtolower(trim($email));
     if ($user->getPassword() !== UserCheck::CreatePassword($password, $user->getSalt())) {
         $this->throwMsg(-10);
     }
     $email_check = UserCheck::CheckEmail($email);
     if ($email_check !== true) {
         throw new \Exception($email_check);
     }
     $meta = ['edit_email_add' => $email, 'edit_email_time' => date("Y-m-d H:i:s"), 'edit_email_code' => salt_hash($email . $user->getEmail(), salt())];
     $user->getMeta()->set($meta);
     $mt = new MailTemplate("edit_email.html");
     $mt->setUserInfo($user->getInfo());
     $mt->setValues(['verify_code' => $meta['edit_email_code']]);
     $mt->mailSend($user->getName(), $email);
 }
コード例 #2
0
ファイル: NoticeApply.php プロジェクト: ttym7993/Linger
 /**
  * 登录限制邮件
  * @param null $rt
  * @param User $user
  * @return null
  */
 public function mail_login_restrictions($rt, $user)
 {
     try {
         if (!$this->notice($user->getId(), 'mail', 'login_restrictions')) {
             return $rt;
         }
         $mt = new MailTemplate("mail_notice/login_restrictions.html");
         $mt->setUserInfo($user->getInfo());
         c_lib()->load('input');
         $input = new Input();
         $mt->setValues(['login_ip' => $input->getRealIP(), 'login_ua' => $input->getUA(), 'login_count' => $user->getErrorLoginCount()]);
         $mt->mailSend($user->getName(), $user->getEmail());
     } catch (\Exception $ex) {
         Log::write(_("NoticeApply mail_login_restrictions create a Exception.") . "EX:[" . $ex->getCode() . "]:" . $ex->getMessage(), Log::NOTICE);
     }
     return $rt;
 }
コード例 #3
0
ファイル: UserLogin.php プロジェクト: ttym7993/Linger
 /**
  * 登录成功的返回信息
  * @return array
  */
 public function LoginContent()
 {
     return ['name' => $this->user->getName(), 'url' => $this->user->getUrl(), 'id' => $this->user->getId(), 'aliases' => $this->user->getAliases(), 'status' => $this->user->getStatus(), 'last_login_time' => $this->user->getLastLoginTime(), 'last_login_ip' => $this->user->getLastLoginIp(), 'avatar' => $this->user->getAvatar(), 'status_info' => $this->user->getStatusInfo($this->user->getStatus())];
 }