Skip to content

Commit c2e7d25

Browse files
committed
fix: update url & perms
1 parent 5e52db5 commit c2e7d25

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

infra/modules/compute/lambda/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ resource "aws_iam_role_policy_attachment" "dynamodb_role_attach" {
2424
policy_arn = "arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess_v2"
2525
}
2626

27+
resource "aws_iam_role_policy_attachment" "ses_role_attach" {
28+
role = aws_iam_role.lambda_execute_role.name
29+
policy_arn = "arn:aws:iam::aws:policy/AmazonSESFullAccess"
30+
}
2731

2832
data "aws_iam_policy_document" "cloudwatch_readwrite" {
2933
statement {

ui/src/components/verify/EmailAuthText.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ import {User} from "../../stores/user.js";
77
88
const KB_API_URL = import.meta.env.VITE_KB_API_URL
99
10+
let props = defineProps({
11+
user: {
12+
type: User,
13+
required: true
14+
}
15+
})
16+
1017
let todo = false;
1118
let emailInput = defineModel();
1219
let disableTextField = ref(false);
@@ -19,13 +26,12 @@ function sendEmail() {
1926
if (!isValidEmail()) return
2027
2128
disableTextField.value = true
22-
const user = User.loadCache();
23-
axios.post(`${KB_API_URL}/verify/email/send`,{
29+
axios.post(`${KB_API_URL}/users/${props.user.userId}/links/send-email`,{
2430
email: emailInput.value
2531
},
2632
{
2733
headers: {
28-
'Authorization': 'Discord ' + user.token.accessToken
34+
'Authorization': 'Discord ' + props.user.token.accessToken
2935
}
3036
}
3137
).then(

ui/src/components/verify/LinkAccountButton.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ import {ref} from "vue";
77
import {onClickOutside} from "@vueuse/core";
88
import {User} from "../../stores/user.js";
99
10-
const userRef = ref(User.loadCache())
10+
const props = defineProps({
11+
user: {
12+
type: User,
13+
required: true
14+
}
15+
})
1116
1217
const modalActiveRef = ref(false)
1318
const modalBox = ref(null)
@@ -19,14 +24,14 @@ onClickOutside(modalBox, () => {
1924
</script>
2025

2126
<template>
22-
<button class="btn btn-xs btn-primary" :class="!userRef ? 'btn-disabled' : ''"
27+
<button class="btn btn-xs btn-primary" :class="!$props.user ? 'btn-disabled' : ''"
2328
@click="modalActiveRef = true">
2429
<fa :icon="['fas', 'plus']"/>
2530
add
2631
</button>
2732

2833
<Teleport to="#modal">
29-
<div class="modal" :class="modalActiveRef ? 'modal-open' : ''" v-if="userRef">
34+
<div class="modal" :class="modalActiveRef ? 'modal-open' : ''" v-if="$props.user">
3035
<div class="modal-box w-96 bg-base-300" ref="modalBox">
3136
<h3 class="text-lg font-bold">Link Account</h3>
3237
<div class="modal-action">
@@ -35,7 +40,7 @@ onClickOutside(modalBox, () => {
3540
<br>
3641
<GoogleAuthButton/>
3742
<div class="divider">Other</div>
38-
<EmailAuthText/>
43+
<EmailAuthText :user="$props.user"/>
3944
</div>
4045

4146
</div>

ui/src/pages/verify/VerifyView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ onMounted(async () => {
4343
<div class="flex flex-col w-full">
4444
<div class="flex flex-row justify-between mb-2.5">
4545
<h3 class="text-lg font-bold self-center">Linked Accounts</h3>
46-
<LinkAccountButton/>
46+
<LinkAccountButton :user="user"/>
4747
</div>
4848
<LinkedAccountsTable/>
4949
</div>

0 commit comments

Comments
 (0)