-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
18 changed files
with
279 additions
and
201 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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import sendEmail from './mailer/SendAnyEmail'; | ||
import Template from './emailTempleteblock'; | ||
import TemplateUnblock from './emailTempleteUnBlock'; | ||
|
||
/** | ||
* @author EmyRukundo | ||
* @class AuthController | ||
* @description this class performs the whole authentication | ||
*/ | ||
class notifyAuthor { | ||
/** | ||
* | ||
* @param {Object} data - Request object | ||
* @param {Object} res - Response object | ||
* @returns {Object} - Response object | ||
*/ | ||
static async notifyAuthorblock(data) { | ||
const mail = { | ||
lastName: data.lastName, email: data.email | ||
}; | ||
const htmlToSend = Template.articleBlockedTemplate(mail.lastName); | ||
await sendEmail(mail, htmlToSend, 'Notification'); | ||
} | ||
|
||
/** | ||
* | ||
* @param {Object} data - Request object | ||
* @param {Object} res - Response object | ||
* @returns {Object} - Response object | ||
*/ | ||
static async notifyAuthorUnblock(data) { | ||
const link = `${process.env.BASE_URL}/api/articles/${data.slug}`; | ||
const mailUnblock = { | ||
lastName: data.lastName, email: data.email | ||
}; | ||
const htmlToSendU = TemplateUnblock.articleUnBlockedTemplate(mailUnblock.lastName, link); | ||
await sendEmail(mailUnblock, htmlToSendU, 'Congratulation'); | ||
} | ||
} | ||
export default notifyAuthor; |
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,41 @@ | ||
/** | ||
* @class ResetPassword | ||
* @description Authentication based class | ||
* */ | ||
class TemplateUnblock { | ||
/** | ||
* Verify token middleware | ||
* @param {String} lastname - Request | ||
* @param {string} link -Article link | ||
* @returns {String} The response String | ||
*/ | ||
static articleUnBlockedTemplate(lastname, link) { | ||
return ` | ||
<div style="background:#e5eeff;width:100%;padding:20px 0;"> | ||
<div style="max-width:760px;margin:0 auto;background:#ffffff"> | ||
<div style="background:#303346;padding:10px;color:#ffffff;text-align:center;font-size:34px"> | ||
Authors Haven | ||
</div> | ||
<div style="padding:20px;text-align:left;"> | ||
<p> | ||
<h2>Dear ${lastname} </h2></br> | ||
Congratulation!! Your article is unblocked on our site, you can visit your article here ${link} </br> | ||
</br> | ||
</p> | ||
<a href="https://andela.com">Visit Andela's website</a> | ||
</div> | ||
<br> | ||
<div style="padding:20px;text-align:left;"> | ||
<b>Authors Haven</b> | ||
</div> | ||
</div> | ||
<div style="padding:35px 10px;text-align:center;"> | ||
Copyright, 2019<br> | ||
Authors Haven | ||
</div> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
export default TemplateUnblock; |
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,42 @@ | ||
/** | ||
* @class ResetPassword | ||
* @description Authentication based class | ||
* */ | ||
class Template { | ||
/** | ||
* Verify token middleware | ||
* @param {String} lastname - Request | ||
* @param {String} token -EmailTemplate | ||
* @returns {String} The response String | ||
*/ | ||
static articleBlockedTemplate(lastname) { | ||
return ` | ||
<div style="background:#e5eeff;width:100%;padding:20px 0;"> | ||
<div style="max-width:760px;margin:0 auto;background:#ffffff"> | ||
<div style="background:#303346;padding:10px;color:#ffffff;text-align:center;font-size:34px"> | ||
Authors Haven | ||
</div> | ||
<div style="padding:20px;text-align:left;"> | ||
<p> | ||
<h2>Dear ${lastname} </h2></br> | ||
Your article is blocked on our site because it doesn't follow our terms and conditions </br> | ||
</br> | ||
If you feel it's just a mistake, you can contact administrator | ||
</p> | ||
<a href="https://andela.com">Visit Andela's website</a> | ||
</div> | ||
<br> | ||
<div style="padding:20px;text-align:left;"> | ||
<b>Authors Haven</b> | ||
</div> | ||
</div> | ||
<div style="padding:35px 10px;text-align:center;"> | ||
Copyright, 2019<br> | ||
Authors Haven | ||
</div> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
export default Template; |
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,48 @@ | ||
/** | ||
* @class Template | ||
* @description Authentication based class | ||
* */ | ||
class Template { | ||
/** | ||
* Verifiy Template | ||
* @param {String} names -EmailTemplate | ||
* @param {String} to -EmailTemplate | ||
* @param {String} token -EmailTemplate | ||
* @returns {String} The response String | ||
*/ | ||
static sendVerification(names, to, token) { | ||
return ` | ||
<div style="background:#e5eeff;width:100%;padding:20px 0;"> | ||
<div style="max-width:760px;margin:0 auto;background:#ffffff"> | ||
<div style="background:#303346;padding:10px;color:#ffffff;text-align:center;font-size:34px"> | ||
Authors Haven - Team Tesla | ||
</div> | ||
<div style="padding:0;"> | ||
</div> | ||
<div style="padding:20px;text-align:left;"> | ||
<p> | ||
Well ${names}, congratulations for choosing AuthorsHaven. | ||
To verify that ${to} is your email, could you please click this link below to verify your AuthorsHaven's account? | ||
<br/> | ||
<a href="${process.env.BASE_URL}/api/auth/verify/?token=${token}">Click here to verify your account</a> | ||
<br/> | ||
Here there is the link below where you can visit Andela and get more information about what's Andela | ||
</p> | ||
<a href="https://andela.com">Visit Andela's website</a> | ||
</div> | ||
<br> | ||
<div style="padding:20px;text-align:left;"> | ||
<b>Andela, Team @Tesla - Cohort 5</b> | ||
</div> | ||
</div> | ||
<div style="padding:35px 10px;text-align:center;"> | ||
Copyright, 2019<br> | ||
Andela, Team Tesla | ||
</div> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
export default Template; |
Oops, something went wrong.