-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eede669
commit 3bd0301
Showing
11 changed files
with
146 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,7 @@ | ||
import { | ||
Body, | ||
Controller, | ||
HttpException, | ||
HttpStatus, | ||
Post, | ||
} from '@nestjs/common' | ||
import { ApiBody, ApiTags } from '@nestjs/swagger' | ||
import { CreateOtpDto } from './dto/create-otp.dto' | ||
import { Controller } from '@nestjs/common' | ||
import { OtpService } from './otp.service' | ||
|
||
@ApiTags('OTP') | ||
@Controller('otp') | ||
export class OtpController { | ||
constructor(private readonly otpService: OtpService) {} | ||
|
||
@ApiBody({ | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
email: { | ||
default: '[email protected]', | ||
}, | ||
}, | ||
}, | ||
}) | ||
@Post() | ||
async create(@Body() createOtpDto: CreateOtpDto) { | ||
try { | ||
const otp = await this.otpService.create(createOtpDto) | ||
return otp | ||
} catch (e) { | ||
throw new HttpException({ message: e.message }, HttpStatus.BAD_REQUEST) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,12 @@ import { JwtAuthGuard } from '@/guard/jwt-auth.guard' | |
import { | ||
Body, | ||
Controller, | ||
Delete, | ||
HttpException, | ||
HttpStatus, | ||
Param, | ||
Patch, | ||
Post, | ||
UseGuards, | ||
} from '@nestjs/common' | ||
import { ApiBearerAuth, ApiBody, ApiTags } from '@nestjs/swagger' | ||
import { CreateUserDto } from './dto/create-user.dto' | ||
import { UpdateUserDto } from './dto/update-user.dto' | ||
import { UserService } from './user.service' | ||
|
||
|
@@ -21,32 +17,6 @@ import { UserService } from './user.service' | |
export class UserController { | ||
constructor(private readonly userService: UserService) {} | ||
|
||
@ApiBody({ | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
email: { | ||
default: '[email protected]', | ||
}, | ||
password: { | ||
default: 'Test123!?', | ||
}, | ||
activationKey: { | ||
default: 'YOUR_KEY', | ||
}, | ||
}, | ||
}, | ||
}) | ||
@Post() | ||
async create(@Body() createUserDto: CreateUserDto) { | ||
try { | ||
const createdUser = await this.userService.create(createUserDto) | ||
return createdUser.toObject() | ||
} catch (e) { | ||
throw new HttpException({ message: e.message }, HttpStatus.BAD_REQUEST) | ||
} | ||
} | ||
|
||
@ApiBody({ | ||
schema: { | ||
type: 'object', | ||
|
@@ -77,14 +47,4 @@ export class UserController { | |
throw new HttpException({ message: e.message }, HttpStatus.BAD_REQUEST) | ||
} | ||
} | ||
|
||
@Delete(':id') | ||
async remove(@Param('id') id: string) { | ||
try { | ||
const deletedUser = await this.userService.remove(id) | ||
return { success: !!deletedUser.deletedCount } | ||
} catch (e) { | ||
throw new HttpException({ message: e.message }, HttpStatus.BAD_REQUEST) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
export function getHTMLForConfirmAccount(activationLink: string) { | ||
return `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Please activate your account</title> | ||
<!--[if mso]><style type="text/css">body, table, td, a { font-family: Arial, Helvetica, sans-serif !important; }</style><![endif]--> | ||
</head> | ||
<body style="font-family: Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; background-color: #ffffff;"> | ||
<table role="presentation" | ||
style="width: 100%; border-collapse: collapse; border: 0px; border-spacing: 0px; font-family: Arial, Helvetica, sans-serif; background-color: rgb(36, 37, 38);"> | ||
<tbody> | ||
<tr> | ||
<td align="center" style="padding: 1rem 2rem; vertical-align: top; width: 100%;"> | ||
<table role="presentation" style="max-width: 600px; border-collapse: collapse; border: 0px; border-spacing: 0px; text-align: left;"> | ||
<tbody> | ||
<tr> | ||
<td style="padding: 40px 0px 0px;"> | ||
<div style="text-align: center;"> | ||
<div style="padding-bottom: 20px;"><img src="https://avatars.githubusercontent.com/u/91463158?v=4" alt="Cloud-storage" | ||
style="width: 56px;"></div> | ||
</div> | ||
<div style="padding: 20px; background-color: rgb(47, 48, 49); border-radius: 12px;"> | ||
<div style="color: rgb(235, 237, 240); text-align: left;"> | ||
<h1 style="margin: 1rem 0; color: #BC98EA;">Final step...</h1> | ||
<p style="padding-bottom: 16px">Follow this link to verify your email address.</p> | ||
<p style="padding-bottom: 16px"><a href="${activationLink}" target="_blank" | ||
style="padding: 12px 24px; border-radius: 4px; color: #000; background: #BC98EA;display: inline-block;margin: 0.5rem 0; text-decoration: none;">Confirm | ||
now</a></p> | ||
<p style="padding-bottom: 16px">If you didn’t ask to verify this address, you can ignore this email.</p> | ||
<p style="padding-bottom: 16px">Best regards, Cloud-storage team.</p> | ||
</div> | ||
</div> | ||
<div style="padding-top: 20px; color: rgb(115, 115, 115); text-align: center;"> | ||
<p style="padding-bottom: 16px">Made with Cloud-storage</p> | ||
</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</body> | ||
</html>` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
export function getHTMLForOTP(otp: number | string) { | ||
return `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Verify your login</title> | ||
<!--[if mso]><style type="text/css">body, table, td, a { font-family: Arial, Helvetica, sans-serif !important; }</style><![endif]--> | ||
</head> | ||
<body style="font-family: Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; background-color: #ffffff;"> | ||
<table role="presentation" | ||
style="width: 100%; border-collapse: collapse; border: 0px; border-spacing: 0px; font-family: Arial, Helvetica, sans-serif; background-color: rgb(36, 37, 38);"> | ||
<tbody> | ||
<tr> | ||
<td align="center" style="padding: 1rem 2rem; vertical-align: top; width: 100%;"> | ||
<table role="presentation" style="max-width: 600px; border-collapse: collapse; border: 0px; border-spacing: 0px; text-align: left;"> | ||
<tbody> | ||
<tr> | ||
<td style="padding: 40px 0px 0px;"> | ||
<div style="text-align: center;"> | ||
<div style="padding-bottom: 20px;"><img src="https://avatars.githubusercontent.com/u/91463158?v=4" alt="Cloud-storage" | ||
style="width: 56px;"></div> | ||
</div> | ||
<div style="padding: 20px; background-color: rgb(47, 48, 49); border-radius: 12px;"> | ||
<div style="color: rgb(235, 237, 240); text-align: left;"> | ||
<h1 style="margin: 1rem 0; color: #BC98EA;">Verification code</h1> | ||
<p style="padding-bottom: 16px">Please use the verification code below to sign in.</p> | ||
<p style="padding-bottom: 16px"><strong style="font-size: 130%; color: #BC98EA;">${otp}</strong></p> | ||
<p style="padding-bottom: 16px">If you didn’t request this, you can ignore this email.</p> | ||
<p style="padding-bottom: 16px">Best regards, Cloud-storage team.</p> | ||
</div> | ||
</div> | ||
<div style="padding-top: 20px; color: rgb(115, 115, 115); text-align: center;"> | ||
<p style="padding-bottom: 16px">Made with Cloud-storage</p> | ||
</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</body> | ||
</html>` | ||
} |
Oops, something went wrong.