Image testing
This commit is contained in:
parent
3bcc854ba1
commit
aca54e6535
4 changed files with 53 additions and 2 deletions
|
|
@ -7,8 +7,8 @@ export default async (user: UserModel) => {
|
|||
const mailOpts = {
|
||||
to: user.email,
|
||||
from: process.env.NODEMAILER_ADDRESS,
|
||||
subject: `Please Validate your Email Address for ${process.env.APP_NAME}`,
|
||||
html: `<!DOCTYPE html> <html lang="en-US"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>Validate Your Email Address for ${process.env.APP_NAME}</title> <style type="text/css">a:hover{text-decoration: underline !important;}</style> </head> <body marginheight="0" topmargin="0" marginwidth="0" style="margin: 0px; background-color: #f2f3f8;" leftmargin="0"> <table cellspacing="0" border="0" cellpadding="0" width="100%" bgcolor="#f2f3f8" style="@import url(https://fonts.googleapis.com/css?family=Rubik:300,400,500,700|Open+Sans:300,400,600,700); font-family: 'Open Sans', sans-serif;"> <tr> <td> <table style="background-color: #f2f3f8; max-width:670px; margin:0 auto;" width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td style="height:80px;"> </td></tr><tr> <td style="text-align:center;"> <a href="http://${process.env.URL}" title="logo" target="_blank"> <img width="60" src="${process.env.LOGO}" title="logo" alt="logo"> </a> </td></tr><tr> <td style="height:20px;"> </td></tr><tr> <td> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" style="max-width:670px;background:#fff; border-radius:3px; text-align:center;-webkit-box-shadow:0 6px 18px 0 rgba(0,0,0,.06);-moz-box-shadow:0 6px 18px 0 rgba(0,0,0,.06);box-shadow:0 6px 18px 0 rgba(0,0,0,.06);"> <tr> <td style="height:40px;"> </td></tr><tr> <td style="padding:0 35px;"> <h1 style="color:#1e1e2d; font-weight:500; margin:0;font-size:32px;font-family:'Rubik',sans-serif;">Please Validate your Email</h1> <span style="display:inline-block; vertical-align:middle; margin:29px 0 26px; border-bottom:1px solid #cecece; width:100px;"></span> <p style="color:#455056; font-size:15px;line-height:24px; margin:0;">A new account for ${process.env.APP_NAME}has been registered to this email address.</p><p> <strong> To verify this email, press the button below. If you did not register with this email address, you can ignore this email entirely.</strong> </p><a href="http://${process.env.URL}/api/v1/user/validateEmail?_id=${user._id}" style="background:#00bee0;text-decoration:none !important; font-weight:500; margin-top:35px; color:#fff;text-transform:uppercase; font-size:14px;padding:10px 24px;display:inline-block;border-radius:50px;"> Reset Password </a> </td></tr><tr> <td style="height:40px;"> </td></tr></table> </td><tr> <td style="height:20px;"> </td></tr><tr> <td style="text-align:center;"> <p style="font-size:14px; color:#076778; line-height:18px; margin:0 0 0;">© <strong>http://${process.env.URL}/</strong></p></td></tr><tr> <td style="height:80px;"> </td></tr></table> </td></tr></table> </body> </html>`,
|
||||
subject: `Please Verify your Email Address for ${process.env.APP_NAME}`,
|
||||
html: `<!DOCTYPE html> <html lang="en-US"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>Verify Your Email Address for ${process.env.APP_NAME}</title> <style type="text/css">a:hover{text-decoration: underline !important;}</style> </head> <body marginheight="0" topmargin="0" marginwidth="0" style="margin: 0px; background-color: #f2f3f8;" leftmargin="0"> <table cellspacing="0" border="0" cellpadding="0" width="100%" bgcolor="#f2f3f8" style="@import url(https://fonts.googleapis.com/css?family=Rubik:300,400,500,700|Open+Sans:300,400,600,700); font-family: 'Open Sans', sans-serif;"> <tr> <td> <table style="background-color: #f2f3f8; max-width:670px; margin:0 auto;" width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td style="height:80px;"> </td></tr><tr> <td style="text-align:center;"> <a href="http://${process.env.URL}" title="logo" target="_blank"> <img width="60" src="${process.env.LOGO}" title="logo" alt="logo"> </a> </td></tr><tr> <td style="height:20px;"> </td></tr><tr> <td> <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" style="max-width:670px;background:#fff; border-radius:3px; text-align:center;-webkit-box-shadow:0 6px 18px 0 rgba(0,0,0,.06);-moz-box-shadow:0 6px 18px 0 rgba(0,0,0,.06);box-shadow:0 6px 18px 0 rgba(0,0,0,.06);"> <tr> <td style="height:40px;"> </td></tr><tr> <td style="padding:0 35px;"> <h1 style="color:#1e1e2d; font-weight:500; margin:0;font-size:32px;font-family:'Rubik',sans-serif;">Please Validate your Email</h1> <span style="display:inline-block; vertical-align:middle; margin:29px 0 26px; border-bottom:1px solid #cecece; width:100px;"></span> <p style="color:#455056; font-size:15px;line-height:24px; margin:0;">A new account for ${process.env.APP_NAME} has been registered to this email address.</p><p> <strong> To verify this email, press the button below. If you did not register with this email address, you can ignore this email entirely.</strong> </p><a href="http://${process.env.URL}/api/v1/user/auth/email/validate?_id=${user._id}" style="background:#00bee0;text-decoration:none !important; font-weight:500; margin-top:35px; color:#fff;text-transform:uppercase; font-size:14px;padding:10px 24px;display:inline-block;border-radius:50px;"> Verify Email </a> </td></tr><tr> <td style="height:40px;"> </td></tr></table> </td><tr> <td style="height:20px;"> </td></tr><tr> <td style="text-align:center;"> <p style="font-size:14px; color:#076778; line-height:18px; margin:0 0 0;">© <strong>http://${process.env.URL}/</strong></p></td></tr><tr> <td style="height:80px;"> </td></tr></table> </td></tr></table> </body> </html>`,
|
||||
};
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ export type ProductModel = Document & {
|
|||
name: string;
|
||||
quantity: number;
|
||||
price: number;
|
||||
images: string[];
|
||||
hidden: boolean;
|
||||
};
|
||||
|
||||
|
|
@ -20,6 +21,13 @@ const ProductSchema = new Schema<ProductModel>({
|
|||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
images: [
|
||||
{
|
||||
type: String,
|
||||
required: true,
|
||||
default: [],
|
||||
},
|
||||
],
|
||||
hidden: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import Footer from './components/Footer';
|
|||
|
||||
// Pages
|
||||
import Home from './pages/Home/index';
|
||||
import Manage from './pages/Manage/index';
|
||||
import Login from './pages/User/Login';
|
||||
import Register from './pages/User/Register';
|
||||
|
||||
|
|
@ -23,6 +24,13 @@ export const Pages = [
|
|||
element: (<Home />),
|
||||
hidden: false,
|
||||
},
|
||||
{
|
||||
name: 'Manage',
|
||||
path: '/manage',
|
||||
icon: null,
|
||||
element: (<Manage />),
|
||||
hidden: false,
|
||||
},
|
||||
{
|
||||
name: 'Login',
|
||||
path: '/login',
|
||||
|
|
|
|||
35
frontend/src/pages/Manage/index.jsx
Normal file
35
frontend/src/pages/Manage/index.jsx
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import React, { useState } from 'react';
|
||||
|
||||
export default () => {
|
||||
const [data, setData] = useState(null);
|
||||
|
||||
const getBase64 = (file) => {
|
||||
const reader = new FileReader();
|
||||
return new Promise((resolve) => {
|
||||
reader.onload = (ev) => {
|
||||
resolve(ev.target.result);
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
};
|
||||
|
||||
const onChange = async (evt) => {
|
||||
const encoded = await Promise.all(Array.from(evt.target.files).map(getBase64));
|
||||
setData(encoded);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<input type="file" multiple accept="image/*" onChange={onChange} />
|
||||
|
||||
<hr />
|
||||
{ data && (
|
||||
<div>
|
||||
<b>Output</b>
|
||||
<p>{data}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Loading…
Reference in a new issue