+ function qrCodeIssuer()
+ {
+ $pg= HTML_FlexyFramework::get()->page;
+
+ $issuer = (empty($pg->company->name)) ? 'ROOJS' : "{$pg->company->name}";
+
+ return $issuer;
+ }
+
+ static function test_ADMIN_PASSWORD_RESET($pg, $to)
+ {
+ $ff = HTML_FlexyFramework::get();
+ $person = DB_DataObject::Factory('core_person');
+ $person->id = -1;
+
+ return array(
+ 'HTTP_HOST' => $_SERVER['SERVER_NAME'],
+ 'person' => $person,
+ 'authFrom' => 'FAKE_LINK',
+ 'authKey' => 'FAKE_KEY',
+
+ 'rcpts' => $to->email,
+ );
+
+ return $content;
+ }
+ function bulkUpdatePasswords($data, $roo)
+ {
+
+ if ( !$roo->hasPerm("Core.Staff", "E")) {
+ $roo->jerr("permission denied");
+ }
+ $rows = explode("\n",$data);
+ $upd = array();
+ $bad = array();
+
+ foreach($rows as $i=>$row) {
+ if (!strlen(trim($row))) {
+ continue;
+ }
+ $bits = preg_split('/\s+/', trim($row));
+ if (count($bits) != 2) {
+ $bad[] = "Invalid line: {$row}";
+ continue;
+ }
+ // validate.
+ $upd[strtolower($bits[0])] = $bits[1];
+
+ }
+ if (empty($upd)) {
+
+ $roo->jerr(empty($bad) ? "No rows to update": ("ERRORS: ". implode("\n", $bad)));
+ return;
+ }
+ // next fetch them all.
+ $p = DB_DataObject::factory('core_person');
+ $p->whereAddIn('email', array_keys($upd), 'string');
+ foreach($p->fetchAll() as $p) {
+ $map[strtolower($p->email)] = $p;
+ }
+ foreach($upd as $k=>$nv) {
+ if (!isset($map[$k])) {
+ $bad[] = "Missing account with email: " . $k;
+ continue;
+ }
+ if ($map[$k]->id == $roo->authUser->id) {
+ $bad[] = "You can not update your own password here: " . $k;
+ continue;
+ }
+ }
+ if (!empty($bad)) {
+ $roo->jerr("ERRORS: ". implode("\n", $bad));
+ return;
+ }
+ foreach($map as $k => $p) {
+ $pp = clone($p);
+ $p->setPassword($upd[$k]);
+ $p->update($pp);
+ }
+ $roo->jok("Updated");
+
+
+ }
+