-
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.
Merge pull request #7 from postech-5soat-grupo-25/alanmmolina/hackath…
…on/alterando-email-remetente atualizando remetente e corrigindo erro na lambda
- Loading branch information
Showing
3 changed files
with
51 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
API_GATEWAY_ID="..." | ||
SES_REGION="us-east-1" | ||
FROM_EMAIL="..." | ||
TO_EMAIL="..." # E-mail do médico a ser enviado | ||
NOME_MEDICO="Dr. João" # Nome do médico | ||
NOME_PACIENTE="Alan" # Nome do paciente | ||
DATA="2024-09-30" # Data da consulta | ||
HORARIO="14:00" # Horário da consulta | ||
|
||
# Chamando o endpoint /email | ||
echo "Enviando o e-mail de confirmação..." | ||
response=$(curl -X POST https://$API_GATEWAY_ID.execute-api.us-east-1.amazonaws.com/prod/email \ | ||
-H "Content-Type: application/json" \ | ||
-d "{\"email_medico\": \"$TO_EMAIL\", \"nome_medico\": \"$NOME_MEDICO\", \"nome_paciente\": \"$NOME_PACIENTE\", \"data\": \"$DATA\", \"horario\": \"$HORARIO\"}") | ||
|
||
echo "Resposta da API: $response" |
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,31 @@ | ||
#!/bin/bash | ||
|
||
API_GATEWAY_ID="..." | ||
USER_POOL_ID="..." | ||
USERNAME="..." | ||
PASSWORD="..." | ||
|
||
# Cria o usuário com uma senha temporária | ||
echo "Criando o usuário..." | ||
aws cognito-idp admin-create-user \ | ||
--user-pool-id $USER_POOL_ID \ | ||
--username $USERNAME \ | ||
--user-attributes Name=email,Value=$USERNAME \ | ||
--temporary-password $PASSWORD \ | ||
--message-action SUPPRESS > /dev/null 2>&1 | ||
|
||
# Altera a senha para uma permanente | ||
echo "Alterando a senha para uma permanente..." | ||
aws cognito-idp admin-set-user-password \ | ||
--user-pool-id $USER_POOL_ID \ | ||
--username $USERNAME \ | ||
--password $PASSWORD \ | ||
--permanent > /dev/null 2>&1 | ||
|
||
echo "Usuário criado e senha alterada com sucesso!" | ||
|
||
# Faz login usando o API Gateway | ||
echo "Realizando o login..." | ||
curl -X POST https://$API_GATEWAY_ID.execute-api.us-east-1.amazonaws.com/prod/login \ | ||
-H "Content-Type: application/json" \ | ||
-d "{\"email\": \"$USERNAME\", \"password\": \"$PASSWORD\"}" |