commit - e595ec2d96e0413bb97cb1e7ef610956b6ffcf13
commit + acf61d77bbe1dd5dacfb0bca6651e25d88c0dfc5
blob - ba576eafe7d5cc13df3641929dbb82d873ef3be8
blob + 3d53e0a5c4821a4adc04b4a1e5e360c16d050edf
--- LICENSE
+++ LICENSE
BSD 3-Clause License
Copyright (c) 2022, Tracey Emery
+Copyright (c) 2022, Hospice Visions, Inc.
+Copyright (c) 2022, Visions Home Health and Visions Home Care, LLC.
All rights reserved.
Redistribution and use in source and binary forms, with or without
blob - b917cbe176d3d01dfa5a4cf1126d5298a081fc06
blob + 0a362d8c5283516f5ec5988da73b282c86e0e768
--- module/Securitx/config/module.config.php
+++ module/Securitx/config/module.config.php
'securitx/securitx/invite' => __DIR__ . '/../view/securitx/invite/invite.phtml',
'securitx/securitx/companies' => __DIR__ . '/../view/securitx/companies/companies.phtml',
'securitx/securitx/user' => __DIR__ . '/../view/securitx/user/user.phtml',
+ 'securitx/securitx/twofa' => __DIR__ . '/../view/securitx/twofa/twofa.phtml',
'securitx/securitx/forgot' => __DIR__ . '/../view/securitx/forgot/forgot.phtml',
'securitx/securitx/requestadmin' => __DIR__ . '/../view/securitx/requestadmin/requestadmin.phtml',
'securitx/securitx/requesteditor' => __DIR__ . '/../view/securitx/requesteditor/requesteditor.phtml',
blob - 3b8051604a0c69d5cfe36e4e5387e8fe6d6ecb8a
blob + 4df64ee1fc31234faef944c91f91b4b650b669c3
--- module/Securitx/src/Controller/SecuritxController.php
+++ module/Securitx/src/Controller/SecuritxController.php
}
if (!$member || !$member->verified)
return $this->redirect()->toRoute('securitx');
+ if ((time() - $member->moddate) > 60 * 60 * 24) {
+ if ((time() - $member->twofa_moddate) ||
+ !$member->twofa_moddate) {
+ $member->twofa = rand(1000000, 9999999);
+ $member->twofa_moddate = time();
+ $this->member_table->saveMember($member);
+ $emailer = new Emailer($this->email_host);
+ $emailer->sendTwofa($member->email,
+ $member->first, $member->last, $url,
+ $this->hipaa['notice'], $member->twofa);
+ }
+ return $this->redirect()->toRoute('securitx',
+ array(
+ 'action' => 'twofa',
+ 'id' => $member->u_key,
+ )
+ );
+ }
$member->moddate = time();
$this->member_table->saveMember($member);
$item['tmp_name']);
$fc = new FileCipher;
$download = new Downloads();
- $download->moddate = time();
$download->id_key = basename($new_name, ".pdf");
$download->u_key = $member->u_key;
$download->e_key = uniqid();
]);
}
}
+ public function twofaAction() {
+ $member = new Member('member');
+ $id = $this->params()->fromRoute('id');
+
+ try {
+ $member = $this->member_table->getVMember($id);
+ } catch (\InvalidArgumentException $ex) {
+ return $this->redirect()->toRoute('securitx');
+ }
+ return new ViewModel([
+ 'member' => $member,
+ ]);
+ }
public function requestadminAction() {
if (!$this->checkAnyAdmin())
return $this->redirect()->toRoute('securitx');
if (!$member || !$member->verified)
return $this->redirect()->toRoute('securitx');
- $member->moddate = time();
$this->member_table->saveMember($member);
/* check member domain */
inviter INTEGER,
r_admin INTEGER,
r_editor INTEGER,
- ip_address TEXT
+ ip_address TEXT,
+ twofa INTEGER,
+ twofa_moddate INTEGER
)
', Adapter::QUERY_MODE_EXECUTE);
$adapter->query('
$member->v_key = '';
$member->u_key = uniqid();
$member->verified = 1;
- $member->moddate = time();
$company =
$this->company_table->getCompany($member->company_id);
echo $new_name;
$fc = new FileCipher;
$download = new Downloads();
- $download->moddate = time();
$download->id_key = basename($new_name, ".pdf");
$download->u_key = $member->u_key;
$download->e_key = uniqid();
blob - 9a7037193619e1c5b4358d3cc02032f63cb44f11
blob + be9bdf845ec75c46dc4d5bcbd1e2de821539f255
--- module/Securitx/src/Model/Emailer.php
+++ module/Securitx/src/Model/Emailer.php
$this->ip = $email_host['ip'];
}
+ public function sendTwofa($email, $first, $last, $url, $hipaa, $code) {
+ $message = new Message();
+ $message->addFrom('no-reply@' . $this->hostname, 'SecuritX');
+ $message->addTo("$email", "$first $last");
+ $message->addReplyTo('no-reply@' . $this->hostname, 'SecuritX');
+ $message->setSubject('Your SecuritX Two Factor Authentication Code');
+ $message->setBody(
+ "Hello $first,\r\n\r\nHere is your two factor " .
+ "authentication code. This code expires in 10 minutes." .
+ "Thank you!\r\n\r\n$code\r\n\r\n" .
+ "--\r\n\r\n$hipaa"
+ );
+
+ $transport = new SmtpTransport();
+ $options = new SmtpOptions([
+ 'name' => $this->hostname,
+ 'host' => $this->ip,
+ ]);
+ $transport->setOptions($options);
+ $transport->send($message);
+ }
public function sendVerifyEmail($email, $first, $last, $url, $hipaa) {
$message = new Message();
$message->addFrom('no-reply@' . $this->hostname, 'SecuritX');
blob - 414e95a954bab674ce7e88ebb69d91722cb8fa32
blob + 895470e6da876a04c6971e23cdca7e96011f6504
--- module/Securitx/src/Model/Member.php
+++ module/Securitx/src/Model/Member.php
public $r_editor;
public $ip_address;
public $company_id;
+ public $twofa;
+ public $twofa_moddate;
private $inputFilter;
$this->r_editor = !empty($data['r_editor']) ? $data['r_editor'] : 0;
$this->ip_address = !empty($data['ip_address']) ? $data['ip_address'] : 0;
$this->company_id = !empty($data['company_id']) ? $data['company_id'] : null;
+ $this->twofa = !empty($data['twofa']) ? $data['twofa'] : null;
+ $this->twofa_moddate = !empty($data['twofa_moddate']) ? $data['twofa_moddate'] : null;
}
public function setInputFilter(InputFilterInterface $inputFilter) {
blob - 7a691a00881e86d261706f4df2c7825918a435ad
blob + f48aee4c1adf8f2c1fe9ff39873d73a1bc68426b
--- module/Securitx/src/Model/MemberTable.php
+++ module/Securitx/src/Model/MemberTable.php
'v_key' => $member->v_key,
'u_key' => $member->u_key,
'verified' => $member->verified,
- 'moddate' => time(),
+ 'moddate' => $member->moddate,
'is_admin' => $member->is_admin,
'is_editor' => $member->is_editor,
'inviter' => $member->inviter,
'r_editor' => $member->r_editor,
'ip_address' => $member->ip_address,
'company_id' => intval($member->company_id),
+ 'twofa' => intval($member->twofa),
+ 'twofa_moddate' => intval($member->twofa_moddate),
];
$id = (int)$member->id;
blob - a06059b2facac850052549539fcb53396bfb5854
blob + 4a331f8cf894a1ae18ae98b03bc4ba8f549f5ce8
--- module/Securitx/view/layout/layout.phtml
+++ module/Securitx/view/layout/layout.phtml
<hr>
<footer>
<p style="text-align: right">
- Copyright © <?= date('Y') ?>, Tracey Emery
+ SecuritX is free and open-source software. Donate to FOSS developers.
</p>
</footer>
</div>
blob - /dev/null
blob + 4f61cec26348400ff9ca32726e54cc546119d9f1 (mode 644)
--- /dev/null
+++ module/Securitx/view/securitx/twofa/twofa.phtml
+<?php
+ $this->headTitle('SecuritX: User Editor');
+?>
+<div class="jumbotron">
+ <h1 class="display-4">Welcome to SecuritX</h1>
+
+ <p>Hello, <?= $member->first ?>,<br />Please enter the code that was emailed to you.<br />If you have not received the email, check your Junk folder.</p>
+
+ <hr class="my-4">
+</div>