|
@@ -61,9 +61,10 @@ class SeminarSignUpController extends ApiController
|
61
|
61
|
$consentAcceptEmail = $request->input('consentAcceptEmail', '');
|
62
|
62
|
$consentPrivacyPolicy = $request->input('consentPrivacyPolicy', '');
|
63
|
63
|
|
64
|
|
- $overOrNot = $this->seminarSignUpSv->overLimitOrNot($trackNo);
|
|
64
|
+ $overOrNot = $this->seminarSignUpSv->overLimitOrNot($trackNo); // true: 可報名 / false: 已額滿
|
|
65
|
+ $duplicatedOrNot = $this->seminarSignUpSv->duplicatedOrNot($trackNo, $companyEmail, $phoneNumber); // true: 可報名 / false: 已重複
|
65
|
66
|
|
66
|
|
- if ($overOrNot) {
|
|
67
|
+ if ($overOrNot&&$duplicatedOrNot) {
|
67
|
68
|
|
68
|
69
|
$this->seminarSignUpSv->insertData(
|
69
|
70
|
$firstName,
|
|
@@ -98,9 +99,12 @@ class SeminarSignUpController extends ApiController
|
98
|
99
|
$this->mailToUser_EN($firstName_orig, $companyEmail_orig, $backupEmail_orig);
|
99
|
100
|
}
|
100
|
101
|
|
101
|
|
- } else {
|
|
102
|
+ } elseif (!$overOrNot) {
|
102
|
103
|
|
103
|
104
|
$res = '已達報名上限';
|
|
105
|
+ } elseif (!$duplicatedOrNot) {
|
|
106
|
+
|
|
107
|
+ $res = '已重複報名';
|
104
|
108
|
}
|
105
|
109
|
$data = [
|
106
|
110
|
'res' => $res,
|
|
@@ -125,22 +129,6 @@ class SeminarSignUpController extends ApiController
|
125
|
129
|
*/
|
126
|
130
|
public function safeEncrypt(string $message, string $skey): string
|
127
|
131
|
{
|
128
|
|
- // if (mb_strlen($key, '8bit') !== SODIUM_CRYPTO_SECRETBOX_KEYBYTES) {
|
129
|
|
- // throw new RangeException('Key is not the correct size (must be 32 bytes).');
|
130
|
|
- // }
|
131
|
|
- // $nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
|
132
|
|
-
|
133
|
|
- // $cipher = base64_encode(
|
134
|
|
- // $nonce .
|
135
|
|
- // sodium_crypto_secretbox(
|
136
|
|
- // $message,
|
137
|
|
- // $nonce,
|
138
|
|
- // $key
|
139
|
|
- // )
|
140
|
|
- // );
|
141
|
|
- // sodium_memzero($message);
|
142
|
|
- // sodium_memzero($key);
|
143
|
|
- // return $cipher;
|
144
|
132
|
$strArr = str_split(base64_encode($message));
|
145
|
133
|
$strCount = count($strArr);
|
146
|
134
|
foreach (str_split($skey) as $key => $value)
|
|
@@ -153,22 +141,6 @@ class SeminarSignUpController extends ApiController
|
153
|
141
|
*/
|
154
|
142
|
public function safeDecrypt(string $encrypted, string $skey): string
|
155
|
143
|
{
|
156
|
|
- // $decoded = base64_decode($encrypted);
|
157
|
|
- // $nonce = mb_substr($decoded, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit');
|
158
|
|
- // $ciphertext = mb_substr($decoded, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit');
|
159
|
|
-
|
160
|
|
- // $plain = sodium_crypto_secretbox_open(
|
161
|
|
- // $ciphertext,
|
162
|
|
- // $nonce,
|
163
|
|
- // $key
|
164
|
|
- // );
|
165
|
|
- // if (!is_string($plain)) {
|
166
|
|
- // throw new Exception('Invalid MAC');
|
167
|
|
- // }
|
168
|
|
- // sodium_memzero($ciphertext);
|
169
|
|
- // sodium_memzero($key);
|
170
|
|
-
|
171
|
|
- // return $plain;
|
172
|
144
|
$strArr = str_split(str_replace(array('O0O0O', 'o000o', 'oo00o'), array('=', ' ', '/'), $encrypted), 2);
|
173
|
145
|
$strCount = count($strArr);
|
174
|
146
|
foreach (str_split($skey) as $key => $value)
|