Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy do frontend #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .firebase/hosting.YnVpbGQ.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
404.html,1696375032226,a7a7ea2ac6dcb29aabc42db1c1a5cc88aba79076ba3c003804cb9d6b391c268e
StyledFirebaseAuth.html,1696375032226,eb2225c9666a5ac028d5bb99acfe0fad4616b4f3d0b741b82a911cbbae7c76c6
vercel.svg,1696375032079,52e0371390cc99e009fdfa1f1c9559010afed60b86f5caaf036bf9bc14ab2501
index.html,1696375032231,05ee378782d9ce06d719d6d7331de67f45f5b82ccf1b62e0c3fcbab6ffdfd7bc
favicon.ico,1696375032079,04614fc32690cb60b39e472119b7f7aa91d88eaeb8511a7489f8cbe1552e6e59
_next/static/chunks/webpack-c3fed87b208006a7.js,1696375032074,6cad6944e2ad0610ca071779a7bc3cecae63c8ed85eef0ed1eb5035b76cee784
_next/static/chunks/pages/StyledFirebaseAuth-9f4ef78f34e26d46.js,1696375032075,23aaff38d666101b22f45eaa1637abd31de2e89b90cb4011c22575414b3fe606
_next/static/chunks/pages/_app-44eef5cac14573bd.js,1696375032075,b328add96d700e76f2304118101161dbdcef84c95580d97c552cc7c1eebe35e7
_next/static/chunks/pages/_error-e4f561a102d9bb14.js,1696375032075,225839a4f0d19ab183b582673691d5d2f42964901096a3e2d506a99c5fd4d536
_next/static/css/ae0e3e027412e072.css,1696375032075,63d020e96167cc4e49510b801a22f81e53632af718861d808aaf393ba3aae8a2
_next/static/chunks/pages/index-4b7c802839152d58.js,1696375032075,50b082a6a39d1ba2333cb21ad2e168f6fbfc18ab450c74b998bbdbbb22a7005a
_next/static/css/ab44ce7add5c3d11.css,1696375032075,8ea7e44d108f8534a55fdf742621af1889c8923812fa03be73712b5e6b528241
_next/static/kzDBaYbAuGIVyvPu_ExL3/_buildManifest.js,1696375032075,99a13e0ce17011684cd5f14c01ba7962b4d7c8500e27ab0b21b7974076f6eb92
_next/static/kzDBaYbAuGIVyvPu_ExL3/_ssgManifest.js,1696375032075,5c126729f9831113842c425975615db312fa26d39f3a9e1baa47d4ad65ac2f90
_next/static/css/1b30cb2a1df9815d.css,1696375032074,bbe47fe9cc441568c6454258b674fec8d8477fc7baf0b0ecd47715dd1edd51da
_next/static/chunks/16-ba1f41b955273432.js,1696375032074,4190e031218d6265167167b9abf47a4a142e4099fc75e418b2371899ce38b1ff
_next/static/chunks/main-e7a7892cb0edc024.js,1696375032074,949782ed5bcdd496102d031a8acc6d0a3dd8a3904bccab641d12a3dee726f762
_next/static/chunks/polyfills-c67a75d1b6f99dc8.js,1696375032075,aba23275a3c1380bfc8d467fd921b0c209e7182dbdaa02611c3a496b0b3b34ec
_next/static/chunks/d6e72859-d6f38619d82295d4.js,1696375032074,e9d2ac366c924bb5825af38032916b333ad525408bb83e82497cb0812c44acd8
_next/static/chunks/248-e8102b226bd866c2.js,1696375032074,c63f3a2b0a2a120abc1fb98e523ac886ebe60a7d0f92e057b2508277712467ff
_next/static/chunks/framework-7751730b10fa0f74.js,1696375032074,5f864035f026a316a3c5d0978aa59ea6738c545d314641e3420dc5d5f8871d31
_next/static/chunks/a2c2a696-a173f432445666d1.js,1696375032074,f5166366eba5ed8383f27a43a4eedd3246dd83f03eea99a75df6567df4816e7b
_next/static/chunks/fec483df-bf669fb1328c428c.js,1696375032074,a5c4e22cc678d4f17d062ed9b8f03253c873204a7cdbdf237dc34ec5bed08a6d
8 changes: 5 additions & 3 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"projects": {
"default": "resetemailccc",
"prod": "resetemailccc"
"default": "reset-senha-ldap",
"prod": "reset-senha-ldap",
"reset-senha": "reset-senha-ldap"
},
"targets": {}
"targets": {},
"etags": {}
}
27 changes: 19 additions & 8 deletions auth/private.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,35 @@ import withAuth from './withAuth';
import { useUser } from './useUser';
import config from '../config';

require('dotenv').config();

const sendRequest = (setResponse) => {
config.auth().currentUser.getIdToken(true).then(function(token) {
const helloUserUrl = "https://us-central1-resetemailccc.cloudfunctions.net/app/hello"
//const helloUserUrl = "http://localhost:5001/resetemailccc/us-central1/app/hello"
document.cookie = '__session=' + token + ';max-age=3600';
console.log('Sending request to', helloUserUrl, 'with ID token in __session cookie.');
config.auth().currentUser.getIdTokenResult(true).then(function(token) {
const apiUrl = "http://localhost:5001/reset_password"
const email = token.claims.email
document.cookie = '__session=' + token.token + ';max-age=3600';
console.log('Sending request to', apiUrl, 'with ID token in __session cookie.');

let req = new XMLHttpRequest();
req.onload = function() {
console.log(req)
setResponse(req.responseText);
};

req.onerror = function() {
setResponse('There was an error');
};
req.open('GET', helloUserUrl, true);

req.open('POST', apiUrl, true);
req.setRequestHeader('Access-Control-Allow-Origin', "*")
req.setRequestHeader('Authorization', 'Bearer ' + token);
req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
req.send();

console.log(email)
req.send(JSON.stringify({
email: email,
key: `${process.env.NEXT_PUBLIC_KEY}`
}));
});
}

Expand Down Expand Up @@ -50,4 +61,4 @@ const Private = () => {
)
}

export default withAuth(Private);
export default withAuth(Private);
13 changes: 7 additions & 6 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import "firebase/compat/auth";

// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyD52Ro63lKnWE1FT1S4XaCGKcuauY_faoc",
authDomain: "resetemailccc.firebaseapp.com",
projectId: "resetemailccc",
storageBucket: "resetemailccc.appspot.com",
messagingSenderId: "299435504310",
appId: "1:299435504310:web:abbf5541e84d763fca6c17"
apiKey: "AIzaSyAHi0quHsP-qV8H3xTF7r2RKfrisDJtjVM",
authDomain: "reset-senha-ldap.firebaseapp.com",
projectId: "reset-senha-ldap",
storageBucket: "reset-senha-ldap.appspot.com",
messagingSenderId: "268223356586",
appId: "1:268223356586:web:06e8e337bdd9b51ee5fad3",
measurementId: "G-DF8WWXJNDC"
};

const app = firebase.initializeApp(firebaseConfig);
Expand Down
4 changes: 2 additions & 2 deletions functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ const validateFirebaseIdToken = async (req, res, next) => {
};

let postCall = async (body) => {
body['key'] = `${process.env.KEY}`
body['key'] = `${process.env.KEY}`
console.log("sending call...")
const response = await fetch('https://sad.splab.ufcg.edu.br:8081/reset_password', {method: 'POST', body: JSON.stringify(body)}).catch(err => console.error(err))
const response = await fetch('http://localhost:5001/reset_password', {method: 'POST', body: JSON.stringify(body)}).catch(err => console.error(err))
const data = await response.json()
console.log("Call result: " + response.status)
return data
Expand Down
Loading