-
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
76c2186
commit 66b8ac9
Showing
13 changed files
with
7,477 additions
and
1,667 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Binary file not shown.
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,21 @@ | ||
-- RedefineTables | ||
PRAGMA foreign_keys=OFF; | ||
CREATE TABLE "new_Uzytkownik" ( | ||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
"password" TEXT NOT NULL, | ||
"mail" TEXT NOT NULL, | ||
"pin" INTEGER, | ||
"token" TEXT, | ||
"loginToken" TEXT, | ||
"imienazwisko" TEXT NOT NULL, | ||
"adres" TEXT NOT NULL, | ||
"czysprzedawca" BOOLEAN NOT NULL, | ||
"czyAdmin" BOOLEAN NOT NULL, | ||
"aktywacja" TEXT NOT NULL DEFAULT '0' | ||
); | ||
INSERT INTO "new_Uzytkownik" ("adres", "czyAdmin", "czysprzedawca", "id", "imienazwisko", "loginToken", "mail", "password", "pin", "token") SELECT "adres", "czyAdmin", "czysprzedawca", "id", "imienazwisko", "loginToken", "mail", "password", "pin", "token" FROM "Uzytkownik"; | ||
DROP TABLE "Uzytkownik"; | ||
ALTER TABLE "new_Uzytkownik" RENAME TO "Uzytkownik"; | ||
CREATE UNIQUE INDEX "Uzytkownik_mail_key" ON "Uzytkownik"("mail"); | ||
PRAGMA foreign_key_check; | ||
PRAGMA foreign_keys=ON; |
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 |
---|---|---|
|
@@ -19,5 +19,16 @@ export const config: TConfig = { | |
}, | ||
}; | ||
|
||
export const mailconfig = { | ||
host: 'h26.seohost.pl', | ||
port: 465, | ||
secure: true, // true for 465, false for other ports | ||
auth: { | ||
user: '[email protected]', // generated ethereal user | ||
pass: 'czapexpol', // generated ethereal password | ||
}, | ||
}; | ||
export const SALT = (process.env.PASSWORD_SALT as string) ?? 't4jn3h4slo'; | ||
export const activateSALT = | ||
(process.env.PASSWORD_SALT as string) ?? 't4jn3h4slo'; | ||
export const SECRET = (process.env.TOKEN_SECRET as string) ?? 't4jn3h4slo'; |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Request, Response } from 'express'; | ||
import { body } from 'express-validator'; | ||
import { StatusCodes } from 'http-status-codes'; | ||
import { TRoute } from '../types'; | ||
import { handleRequest } from '../../utils/request.utils'; | ||
import { verify } from '../../functions/users'; | ||
|
||
export default { | ||
method: 'get', | ||
path: '/api/user/verify/:token', | ||
validators: [], | ||
handler: async (req: Request, res: Response) => | ||
handleRequest({ | ||
req, | ||
res, | ||
responseDefaultStatus: StatusCodes.OK, | ||
execute: async () => { | ||
return verify(req.params.token); | ||
}, | ||
}), | ||
} as TRoute; |
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,26 @@ | ||
import nodemailer from 'nodemailer'; | ||
import { mailconfig } from '../config'; | ||
export async function sendmail( | ||
to: string, | ||
subject: string, | ||
text: string, | ||
html: string, | ||
) { | ||
const transporter = nodemailer.createTransport(mailconfig); | ||
|
||
const info = await transporter.sendMail({ | ||
from: '"CZEPEXPOL" <[email protected]>', // sender address | ||
to: to, // list of receivers | ||
subject: subject, // Subject line | ||
text: text, // plain text body | ||
html: html, // html body | ||
}); | ||
|
||
//from: '"CZEPEXPOL" <[email protected]>', | ||
//to: '[email protected]', | ||
//subject: 'Hello ✔', | ||
//text: 'Hello world', | ||
//html: '<b>Hello world</b>', | ||
|
||
console.log('Message sent: %s', info.messageId); | ||
} |
Oops, something went wrong.