diff --git a/404.html b/404.html index 9e205e944..f71007ea9 100644 --- a/404.html +++ b/404.html @@ -15,7 +15,7 @@ - +
diff --git a/assets/js/dd30c1b8.c649453a.js b/assets/js/dd30c1b8.c649453a.js new file mode 100644 index 000000000..aff2b8f34 --- /dev/null +++ b/assets/js/dd30c1b8.c649453a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkadminforth=self.webpackChunkadminforth||[]).push([[5552],{8671:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>l,contentTitle:()=>o,default:()=>h,frontMatter:()=>t,metadata:()=>a,toc:()=>d});var r=n(4848),i=n(8453);const t={},o="Email password reset",a={id:"tutorial/Plugins/email-password-reset",title:"Email password reset",description:"Plugin allows to reset password for admin users who forgot their password by sending email with reset link signed with secured JWT token.",source:"@site/docs/tutorial/05-Plugins/07-email-password-reset.md",sourceDirName:"tutorial/05-Plugins",slug:"/tutorial/Plugins/email-password-reset",permalink:"/docs/tutorial/Plugins/email-password-reset",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:7,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Chat-GPT",permalink:"/docs/tutorial/Plugins/chat-gpt"},next:{title:"Import-Export",permalink:"/docs/tutorial/Plugins/import-export"}},l={},d=[{value:"SES",id:"ses",level:2}];function c(e){const s={a:"a",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",li:"li",ol:"ol",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.h1,{id:"email-password-reset",children:"Email password reset"}),"\n",(0,r.jsx)(s.p,{children:"Plugin allows to reset password for admin users who forgot their password by sending email with reset link signed with secured JWT token."}),"\n",(0,r.jsxs)(s.blockquote,{children:["\n",(0,r.jsx)(s.p,{children:"\u26a0\ufe0f if users created manually in backoffice, ensuring that email is valid is responsibility of the admin which might be a security risk\n(if email is mistyped then, person who owns mistyped email can reset password and get access)"}),"\n"]}),"\n",(0,r.jsxs)(s.blockquote,{children:["\n",(0,r.jsx)(s.p,{children:"\u26a0\ufe0f If user with email does not exist, plugin will still show to user success message to prevent email enumeration."}),"\n"]}),"\n",(0,r.jsx)(s.p,{children:"Installation:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-bash",children:"npm install @adminforth/email-password-reset\n"})}),"\n",(0,r.jsx)(s.p,{children:"Import plugin:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-typescript",children:"import EmailResetPasswordPlugin from '@adminforth/email-password-reset';\n"})}),"\n",(0,r.jsx)(s.h2,{id:"ses",children:"SES"}),"\n",(0,r.jsx)(s.p,{children:"To Setup SES, you need to have an AWS account and SES service enabled. You can follow the steps below to setup SES."}),"\n",(0,r.jsxs)(s.ol,{children:["\n",(0,r.jsxs)(s.li,{children:["\n",(0,r.jsxs)(s.p,{children:["Go to the AWS Management Console and open the Amazon SES console at ",(0,r.jsx)(s.a,{href:"https://console.aws.amazon.com/ses/",children:"https://console.aws.amazon.com/ses/"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(s.li,{children:["\n",(0,r.jsxs)(s.p,{children:["Make sure you are in the correct region. You can change the region from the top right corner. For example, if you are in the ",(0,r.jsx)(s.code,{children:"us-east-1"})," region, you can see the region name US East (N. Virginia) in the top right corner."]}),"\n"]}),"\n",(0,r.jsxs)(s.li,{children:["\n",(0,r.jsx)(s.p,{children:"Add your email address (any email), and verify it."}),"\n"]}),"\n",(0,r.jsxs)(s.li,{children:["\n",(0,r.jsxs)(s.p,{children:["Add some domain you own and verify it by creating DNS records which AWS suggests. This will be used as the domain for sending emails. e.g. if you want to send from ",(0,r.jsx)(s.a,{href:"mailto:no-reply@devforth.io",children:"no-reply@devforth.io"})," you need to verify ",(0,r.jsx)(s.code,{children:"devforth.io"}),"."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(s.p,{children:"Add plugin to user resource:"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-typescript",metastring:"./resources/users.ts",children:"import EmailResetPasswordPlugin from '@adminforth/email-password-reset';\nimport EmailAdapterAwsSes from '@adminforth/email-adapter-aws-ses';\n...\nplugins: [\n ...\n new EmailResetPasswordPlugin({\n // field in user resource which contains email\n emailField: 'email',\n\n // field in user resource which contains password constrains. Should be virtual field\n passwordField: 'password',\n\n // domain part should be verified in SES\n sendFrom: 'no-reply@devforth.io',\n\n adapter: new EmailAdapterAwsSes({\n // region where SES is setup\n region: \"eu-central-1\",\n accessKeyId: process.env.AWS_ACCESS_KEY_ID as string,\n secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY as string,\n }),\n\n }),\n]\n"})}),"\n",(0,r.jsxs)(s.p,{children:["Make sure to to place your AWS credentials in ",(0,r.jsx)(s.code,{children:".env"})," file/environment."]}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-bash",metastring:"/.env",children:"AWS_ACCESS_KEY_ID=your-access-key\nAWS_SECRET_ACCESS_KEY=your-secret-key\n"})})]})}function h(e={}){const{wrapper:s}={...(0,i.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,s,n)=>{n.d(s,{R:()=>o,x:()=>a});var r=n(6540);const i={},t=r.createContext(i);function o(e){const s=r.useContext(t);return r.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function a(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:o(e.components),r.createElement(t.Provider,{value:s},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/dd30c1b8.e977f9dc.js b/assets/js/dd30c1b8.e977f9dc.js deleted file mode 100644 index d3c22b871..000000000 --- a/assets/js/dd30c1b8.e977f9dc.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkadminforth=self.webpackChunkadminforth||[]).push([[5552],{8671:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>t,default:()=>u,frontMatter:()=>o,metadata:()=>a,toc:()=>d});var r=s(4848),i=s(8453);const o={},t="Email password reset",a={id:"tutorial/Plugins/email-password-reset",title:"Email password reset",description:"Plugin allows to reset password for admin users who forgot their password by sending email with reset link signed with secured JWT token.",source:"@site/docs/tutorial/05-Plugins/07-email-password-reset.md",sourceDirName:"tutorial/05-Plugins",slug:"/tutorial/Plugins/email-password-reset",permalink:"/docs/tutorial/Plugins/email-password-reset",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:7,frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Chat-GPT",permalink:"/docs/tutorial/Plugins/chat-gpt"},next:{title:"Import-Export",permalink:"/docs/tutorial/Plugins/import-export"}},l={},d=[{value:"SES",id:"ses",level:2}];function c(e){const n={a:"a",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",li:"li",ol:"ol",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"email-password-reset",children:"Email password reset"}),"\n",(0,r.jsx)(n.p,{children:"Plugin allows to reset password for admin users who forgot their password by sending email with reset link signed with secured JWT token."}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:"\u26a0\ufe0f if users created manually in backoffice, ensuring that email is valid is responsibility of the admin which might be a security risk\n(if email is mistyped then, person who owns mistyped email can reset password and get access)"}),"\n"]}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsx)(n.p,{children:"\u26a0\ufe0f If user with email does not exist, plugin will still show to user success message to prevent email enumeration."}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Installation:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",children:"npm install @adminforth/email-password-reset\n"})}),"\n",(0,r.jsx)(n.p,{children:"Import plugin:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",children:"import EmailResetPasswordPlugin from '@adminforth/email-password-reset';\n"})}),"\n",(0,r.jsx)(n.h2,{id:"ses",children:"SES"}),"\n",(0,r.jsx)(n.p,{children:"To Setup SES, you need to have an AWS account and SES service enabled. You can follow the steps below to setup SES."}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Go to the AWS Management Console and open the Amazon SES console at ",(0,r.jsx)(n.a,{href:"https://console.aws.amazon.com/ses/",children:"https://console.aws.amazon.com/ses/"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Make sure you are in the correct region. You can change the region from the top right corner. For example, if you are in the ",(0,r.jsx)(n.code,{children:"us-east-1"})," region, you can see the region name US East (N. Virginia) in the top right corner."]}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsx)(n.p,{children:"Add your email address (any email), and verify it."}),"\n"]}),"\n",(0,r.jsxs)(n.li,{children:["\n",(0,r.jsxs)(n.p,{children:["Add some domain you own and verify it by creating DNS records which AWS suggests. This will be used as the domain for sending emails. e.g. if you want to send from ",(0,r.jsx)(n.a,{href:"mailto:no-reply@devforth.io",children:"no-reply@devforth.io"})," you need to verify ",(0,r.jsx)(n.code,{children:"devforth.io"}),"."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"Add plugin to user resource:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-typescript",metastring:"./resources/users.ts",children:"...\nplugins: [\n ...\n new EmailResetPasswordPlugin({\n emailProvider: 'AWS_SES',\n // field in user resource which contains email\n emailField: 'email',\n\n // field in user resource which contains password constrains. Should be virtual field\n passwordField: 'password',\n\n // domain part should be verified in SES\n sendFrom: 'no-reply@devforth.io',\n\n providerOptions: {\n AWS_SES: {\n // region where SES is setup\n region: 'eu-central-1',\n accessKeyId: process.env.AWS_ACCESS_KEY_ID as string,\n secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY as string,\n }\n }\n\n }),\n]\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Make sure to to place your AWS credentials in ",(0,r.jsx)(n.code,{children:".env"})," file/environment."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:"/.env",children:"AWS_ACCESS_KEY_ID=your-access-key\nAWS_SECRET_ACCESS_KEY=your-secret-key\n"})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>t,x:()=>a});var r=s(6540);const i={},o=r.createContext(i);function t(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:t(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.98585307.js b/assets/js/runtime~main.1bb4d74d.js similarity index 99% rename from assets/js/runtime~main.98585307.js rename to assets/js/runtime~main.1bb4d74d.js index d92ff32e7..584e9464d 100644 --- a/assets/js/runtime~main.98585307.js +++ b/assets/js/runtime~main.1bb4d74d.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,f,c,d,b={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var f=t[e]={exports:{}};return b[e].call(f.exports,f,f.exports,r),f.exports}r.m=b,e=[],r.O=(a,f,c,d)=>{if(!f){var b=1/0;for(i=0;iAdd plugin to user resource:
-...
plugins: [
...
new EmailResetPasswordPlugin({
emailProvider: 'AWS_SES',
// field in user resource which contains email
emailField: 'email',
// field in user resource which contains password constrains. Should be virtual field
passwordField: 'password',
// domain part should be verified in SES
sendFrom: 'no-reply@devforth.io',
providerOptions: {
AWS_SES: {
// region where SES is setup
region: 'eu-central-1',
accessKeyId: process.env.AWS_ACCESS_KEY_ID as string,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY as string,
}
}
}),
]
import EmailResetPasswordPlugin from '@adminforth/email-password-reset';
import EmailAdapterAwsSes from '@adminforth/email-adapter-aws-ses';
...
plugins: [
...
new EmailResetPasswordPlugin({
// field in user resource which contains email
emailField: 'email',
// field in user resource which contains password constrains. Should be virtual field
passwordField: 'password',
// domain part should be verified in SES
sendFrom: 'no-reply@devforth.io',
adapter: new EmailAdapterAwsSes({
// region where SES is setup
region: "eu-central-1",
accessKeyId: process.env.AWS_ACCESS_KEY_ID as string,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY as string,
}),
}),
]
Make sure to to place your AWS credentials in .env
file/environment.
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key