public function log() : string { error_log(__METHOD__); list($l, $m) = util::log(); return $m ? ' <p class="alert ' . $l . '">' . $m . '</p>' : ''; }
public static function chkpw($pw, $pw2) { error_log(__METHOD__); if (strlen($pw) > 9) { if (preg_match('/[0-9]+/', $pw)) { if (preg_match('/[A-Z]+/', $pw)) { if (preg_match('/[a-z]+/', $pw)) { if ($pw === $pw2) { return true; } else { util::log('Passwords do not match, please try again'); } } else { util::log('Password must contains at least one lower case letter'); } } else { util::log('Password must contains at least one captital letter'); } } else { util::log('Password must contains at least one number'); } } else { util::log('Passwords must be at least 10 characters'); } return false; }
/** * 发送客服消息 * @param array $data 消息结构{"touser":"******","msgtype":"news","news":{...}} * @return boolean|array */ public function send() { if (!$this->access_token && !$this->checkAuth()) { return false; } $result = $this->http_post(self::API_CGI_PREFIX . self::CUSTOM_SEND_URL . 'access_token=' . $this->access_token, self::json_encode($this->_msg)); if ($result) { $json = json_decode($result, true); if (!$json || !empty($json['errcode'])) { $this->errCode = $json['errcode']; $this->errMsg = $json['errmsg']; util::log("111"); return false; util::log("222"); } util::log("333"); return $json; util::log("444"); } util::log("555"); return false; util::log("666"); }
public function doIndex() { util::log("12345"); resource::getView('admin')->display('index.tpl'); }
public function log() : string { list($l, $m) = $this->g->in['l'] ? explode(':', $this->g->in['l']) : util::log(); return $m ? ' <p class="demo-alert' . $this->mdl_color($l) . '">' . $m . ' </p>' : ''; }
public function resetpw() : string { error_log(__METHOD__); if (count($_POST)) { $id = $this->g->in['i']; if ($usr = db::read('uid,acl,otpttl', 'id', $id, '', 'one')) { $p1 = html_entity_decode($this->in['passwd1']); $p2 = html_entity_decode($this->in['passwd2']); if (util::chkpw($p1, $p2)) { if ($usr['otpttl'] && $usr['otpttl'] + 3600 > time()) { if ($usr['acl']) { if (db::update(['webpw' => password_hash($p1, PASSWORD_DEFAULT), 'otp' => '', 'otpttl' => '', 'updated' => date('Y-m-d H:i:s')], [['id', '=', $id]])) { util::log('Password reset for ' . $usr['uid'], 'success'); return $this->t->auth_signin(['uid' => $usr['uid']]); return; } else { util::log('Problem updating database'); } } else { util::log($usr['uid'] . ' is not allowed access'); } } else { util::log('Your one time password key has expired'); } } } else { util::log('User does not exist'); } } return $this->t->auth_newpw(['id' => $id, 'uid' => $usr['uid']]); }