Skip to content

Commit 3020be2

Browse files
authored
ft(#431)non-trainee-invitation (#433)
1 parent 6fd2a27 commit 3020be2

File tree

2 files changed

+58
-1
lines changed

2 files changed

+58
-1
lines changed

src/resolvers/userResolver.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ import { EmailPattern } from '../utils/validation.utils'
3737
import { Context } from './../context'
3838
import { UserInputError } from 'apollo-server'
3939
import { encodeOtpToToken, generateOtp } from '../utils/2WayAuthentication'
40-
import jwt from 'jsonwebtoken'
40+
import jwt from 'jsonwebtoken'
41+
import nonTraineeTemplate from '../utils/templates/nonTraineeTemplate'
4142
const octokit = new Octokit({ auth: `${process.env.Org_Repo_Access}` })
4243

4344
const SECRET = (process.env.SECRET as string) || 'mysq_unique_secret'
@@ -328,6 +329,10 @@ const resolvers: any = {
328329
invitation.status = 'accepted'
329330
await invitation.save()
330331
}
332+
if(user.role !=='trainee'){
333+
const content = nonTraineeTemplate( user.email,password,org.name)
334+
sendEmail(user.email,'Login Details',content,process.env.FRONTEND_LINK, process.env.ADMIN_EMAIL, process.env.ADMIN_PASS)
335+
}
331336

332337
const newProfile = await Profile.create({
333338
user,
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
const link = process.env.FRONTEND_LINK + '/login/org'
2+
3+
export default function Template(email:string,password:string,orgName:string) {
4+
return /* html */ `
5+
<table style="font-size: 16px; font-family: 'Rubik'; text-align: left">
6+
<tbody>
7+
<tr>
8+
<td>
9+
<br />
10+
<p style="margin-bottom: 5px">
11+
Welcome to <strong>${orgName}</strong> organization, Below are your login details:<br>
12+
You have signed up with email: <strong>${email}</strong>, and password: <strong>${password}</strong>. <br>
13+
You will now use it to login from here on.
14+
</p>
15+
<p style="margin-bottom: 10px">
16+
Use the button below to login into the organization.
17+
</p>
18+
19+
20+
<a href="${link}" style="text-decoration: none; cursor: pointer">
21+
<button
22+
style="
23+
font-size: 16px;
24+
background-color: rgb(134, 103, 242);
25+
font-family: 'Rubik';
26+
text-align: center;
27+
border: none;
28+
border-radius: 3px;
29+
padding: 5px;
30+
cursor: pointer;
31+
color: whitesmoke;
32+
"
33+
>
34+
Login
35+
</button>
36+
</a>
37+
<br />
38+
<br />
39+
40+
<p>
41+
If you think this email reached your inbox by mistake, simply ignore it.
42+
</p>
43+
<br />
44+
<br />
45+
46+
<p>Best Regard,</p>
47+
<p>Pulse team</p>
48+
</td>
49+
</tr>
50+
</tbody>
51+
</table>`
52+
}

0 commit comments

Comments
 (0)