Skip to content

Commit

Permalink
Merge pull request #46 from ledgerleapllc/development
Browse files Browse the repository at this point in the history
Sync development to staging
  • Loading branch information
ledgerleapllc authored Jun 20, 2022
2 parents 5ebf9c5 + 82f100d commit 926a0d1
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions app/Http/Controllers/Api/V1/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,16 @@ public function uploadLetter(Request $request)
'file' => 'required|mimes:pdf,docx,doc,txt,rtf|max:20000',
]);

if ($validator->fails()) return $this->validateResponse($validator->errors());
if ($validator->fails()) {
return $this->validateResponse($validator->errors());
}

$user = auth()->user();
$filenameWithExt = $request->file('file')->getClientOriginalName();
$filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
$extension = $request->file('file')->getClientOriginalExtension();
$filenamehash = md5(Str::random(10) . '_' . (string)time());
$fileNameToStore = $filenamehash . '.' . $extension;
$filenamehash = md5(Str::random(10).'_'.(string)time());
$fileNameToStore = $filenamehash.'.'.$extension;

// S3 file upload
$S3 = new S3Client([
$S3client = new S3Client([
'version' => 'latest',
'region' => getenv('AWS_DEFAULT_REGION'),
'credentials' => [
Expand All @@ -268,7 +267,7 @@ public function uploadLetter(Request $request)
],
]);

$s3result = $S3->putObject([
$s3result = $S3client->putObject([
'Bucket' => getenv('AWS_BUCKET'),
'Key' => 'letters_of_motivation/'.$fileNameToStore,
'SourceFile' => $request->file('file')
Expand Down Expand Up @@ -489,7 +488,6 @@ public function verifyFileCasperSigner2(VerifyFileCasperSignerRequest $request)
if ($verified) {
$filenamehash = md5(Str::random(10) . '_' . (string)time());

// S3 file upload
$S3 = new S3Client([
'version' => 'latest',
'region' => getenv('AWS_DEFAULT_REGION'),
Expand All @@ -506,7 +504,7 @@ public function verifyFileCasperSigner2(VerifyFileCasperSignerRequest $request)
]);

$ObjectURL = $s3result['ObjectURL'] ?? getenv('SITE_URL').'/not-found';

$userAddress = new UserAddress;
$userAddress->user_id = $user->id;
$userAddress->public_address_node = $public_validator_key;
Expand Down

0 comments on commit 926a0d1

Please sign in to comment.