Skip to content

Commit c4d5d14

Browse files
authored
Merge pull request #2 from oslabs-beta/Oauth
Oauth
2 parents f97e123 + 3d69158 commit c4d5d14

File tree

11 files changed

+9
-29
lines changed

11 files changed

+9
-29
lines changed

app/electron/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ app.on('ready', createWindow);
204204

205205
// Quit when all windows are closed.
206206
app.on('window-all-closed', () => {
207+
require('electron').app.getPath('userData');
208+
win.webContents.executeJavaScript('window.localStorage.clear();');
207209
app.quit();
208210
});
209211

@@ -258,7 +260,6 @@ app.on('web-contents-created', (event, contents) => {
258260
'https://www.html5rocks.com',
259261
'app://rse/'
260262
];
261-
262263
// Log and prevent the app from redirecting to a new page
263264
if (
264265
!validOrigins.includes(parsedUrl.origin)
@@ -368,7 +369,6 @@ ipcMain.on('set_cookie', event => {
368369
// this if statement is necessary or the setInterval on main app will constantly run and will emit this event.reply, causing a memory leak
369370
// checking for a cookie inside array will only emit reply when a cookie exists
370371
if (cookie[0]) {
371-
//console.log(cookie);
372372
event.reply('give_cookie', cookie);
373373
}
374374
})
@@ -466,7 +466,7 @@ ipcMain.on('github', event => {
466466
github.close();
467467
win.webContents
468468
.executeJavaScript(`window.localStorage.setItem('ssid', '${ssid}')`)
469-
.then(result => win.loadURL(`app://rse?=${ssid}`))
469+
.then(result => win.loadURL(`${redirectUrl}`))
470470
.catch(err => console.log(err));
471471
}
472472
});

app/src/components/bottom/BottomTabs.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ const useStyles = makeStyles(theme => ({
116116
boxShadow: '0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)',
117117

118118
},
119-
rootLight: isThemeLight => ({
120-
backgroundColor: isThemeLight ? 'blue': 'red'
121-
}),
119+
rootLight: {
120+
backgroundColor: '#003366'
121+
},
122122
bottomHeader: {
123123
flex: 1,
124124
flexDirection: 'row',

app/src/components/right/TableStateProps.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { StatePropsPanelProps } from '../../interfaces/Interfaces';
1313

1414
const getColumns = (props) => {
1515
const { deleteHandler } : StatePropsPanelProps = props;
16-
console.log('isThemeLight: ',props.isThemeLight)
1716
return [
1817
{
1918
field: 'id',
@@ -71,7 +70,6 @@ const TableStateProps = (props) => {
7170

7271

7372
useEffect(() => {
74-
console.log('isThemeLight: ',props.isThemeLight)
7573
setGridColumns(getColumns(props));
7674
}, [props.isThemeLight])
7775
// get currentComponent by using currently focused component's id

app/src/helperFunctions/gitHubOauth.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const handleGitHubOauth = () => {
2-
console.log('git hub');
32
const gitHubUrl = 'https://github.com/login/oauth/authorize?';
43
const authUrl =
54
`${gitHubUrl}client_id=`;

app/src/utils/createApplication.util.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ async function createApplicationUtil({
346346
appName: string;
347347
components: Component[];
348348
}) {
349-
console.log('in the createApplication util');
350349

351350
await createIndexHtml(path, appName);
352351
await createIndexTsx(path, appName);

app/src/utils/createGatsbyApp.util.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,11 @@ async function createGatsbyAppUtil({
147147
components: Component[];
148148
rootComponents: number[];
149149
}) {
150-
console.log('in the createGatsbyApplication util');
151-
152150
await initFolders(path, appName);
153151
await createBaseTsx(path, appName);
154152
await createDefaultCSS(path, appName, components);
155153
await createPackage(path, appName);
156154
await createTsConfig(path, appName);
157155
await createGatsbyFiles(components, path, appName, rootComponents);
158-
159156
}
160157
export default createGatsbyAppUtil;

app/src/utils/createNextApp.util.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,11 @@ async function createNextAppUtil({
146146
components: Component[];
147147
rootComponents: number[];
148148
}) {
149-
console.log('in the createNextApplication util');
150-
151149
await initFolders(path, appName);
152150
await createBaseTsx(path, appName);
153151
await createDefaultCSS(path, appName, components);
154152
await createPackage(path, appName);
155153
await createTsConfig(path, appName);
156154
await createNextFiles(components, path, appName, rootComponents);
157-
158155
}
159156
export default createNextAppUtil;

server/controllers/sessionController.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ sessionController.startSession = (req, res, next) => {
4040
log: `Error in sessionController.startSession find session: ${err}`,
4141
message: {
4242
err:
43-
'Error in sessionController.startSession find session, check server logs for details'
43+
'Error in sessionController.startSession find session, check server logs for details'
4444
}
4545
});
4646
// if session doesn't exist, create a session
@@ -69,19 +69,13 @@ sessionController.startSession = (req, res, next) => {
6969
};
7070

7171
sessionController.gitHubResponse = (req, res, next) => {
72-
console.log('hi')
7372
const { code } = req.query;
74-
console.log('code:',code)
75-
console.log('code =>', code);
76-
console.log('JSON:', )
77-
console.log(process.env.GITHUB_ID)
7873
if (!code)
7974
return next({
8075
log: 'Undefined or no code received from github.com',
8176
message: 'Undefined or no code received from github.com',
8277
status: 400
8378
});
84-
console.log('heyyyy');
8579
fetch(`https://github.com/login/oauth/access_token?client_id=${process.env.GITHUB_ID}&client_secret=${process.env.GITHUB_SECRET}&code=${code}`, {
8680
method: 'POST',
8781
headers: {
@@ -96,13 +90,10 @@ sessionController.gitHubResponse = (req, res, next) => {
9690
})
9791
.then(res => res.json())
9892
.then(token => {
99-
console.log('hi');
100-
console.log('token: ',token['access_token'] )
10193
res.locals.token = token['access_token'];
10294
return next();
10395
})
10496
.catch(err => {
105-
console.log('hi');
10697
res.status(500).json({ message: `${err.message} in gitHubResponse` })
10798
}
10899
);
@@ -120,7 +111,6 @@ sessionController.gitHubSendToken = (req, res, next) => {
120111
})
121112
.then(res => res.json())
122113
.then(data => {
123-
console.log('this is data:', data);
124114
res.locals.githubEmail = data[0]['email'];
125115
res.locals.signUpType = 'oauth';
126116
return next();

server/controllers/userController.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ userController.createUser = (req, res, next) => {
8585
userController.verifyUser = (req, res, next) => {
8686
let { username, password, isFbOauth } = req.body;
8787
// handle Oauth
88-
console.log('We verifying');
8988
if (res.locals.signUpType === 'oauth') {
9089
username = res.locals.githubEmail;
9190
password = res.locals.githubPassword;

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"test": "jest --verbose ",
1111
"test:watch": "jest --watch",
1212
"start": "cross-env NODE_ENV=production node server.js",
13-
"prod": "cross-env NODE_ENV=production server.js",
13+
"prod": "cross-env NODE_ENV=production nodemon server.js",
1414
"dev": "cross-env NODE_ENV=development nodemon server.js"
1515
},
1616
"keywords": [],

server/server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ app.get(
5555
if (isDev) {
5656
return res.status(200).redirect(`http://localhost:8080?=${res.locals.ssid}`);
5757
} else {
58+
console.log('res.locals.ssid: ',res.locals.ssid);
5859
return res.status(200).redirect(`app://rse?=${res.locals.ssid}`);
5960
}
6061
}

0 commit comments

Comments
 (0)