Skip to content

Commit bab294f

Browse files
committed
linting fix
1 parent 4f6d247 commit bab294f

File tree

9 files changed

+29
-29
lines changed

9 files changed

+29
-29
lines changed

app.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const analyticsRouter = require('./app/routes/analytics')
3030
const wikisRouter = require('./app/routes/wikis')
3131
const activityRouter = require('./app/routes/activity')
3232
const ticketRouter = require('./app/routes/ticket')
33-
const passport = require('passport');
33+
const passport = require('passport')
3434
const app = express()
3535
const server = require('http').Server(app)
3636
const clientbaseurl = process.env.clientbaseurl || 'http://localhost:3000'
@@ -43,9 +43,9 @@ app.use(cookieParser())
4343
app.use(bodyParser.urlencoded(fileConstants.fileParameters))
4444

4545
// PassportJS for OAuth
46-
app.use(passport.initialize());
47-
passportOAuth.initGoogleAuth();
48-
passportOAuth.initGitHubAuth();
46+
app.use(passport.initialize())
47+
passportOAuth.initGoogleAuth()
48+
passportOAuth.initGitHubAuth()
4949

5050
const memoryStorage = multer.memoryStorage()
5151
app.use(multer({ storage: memoryStorage }).single('file'))

app/controllers/auth.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ module.exports = {
99
try {
1010
const user = await User.findByCredentials(email, password)
1111
const token = await user.generateAuthToken()
12-
res.cookie("token", token, { httpOnly: true }).send({ user: user })
12+
res.cookie('token', token, { httpOnly: true }).send({ user: user })
1313
} catch (error) {
1414
res.status(HttpStatus.BAD_REQUEST).json({ error: error.message })
1515
}
1616
},
1717
logout: (req, res, next) => {
1818
activityHelper.addActivityToDb(req, res)
19-
res.clearCookie("token");
19+
res.clearCookie('token')
2020
res.status(HttpStatus.OK).json({ success: 'ok' })
2121
},
2222
logoutAll: (req, res, next) => {

app/controllers/email.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const sendgridMail = require('@sendgrid/mail')
22
const ejs = require('ejs')
33
const path = require('path')
44
const sendGridApi = process.env.SENDGRID_API_KEY || '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'
5-
const SENDGRID_FROM_EMAIL_ADDRESS = process.env.SENDGRID_FROM_EMAIL_ADDRESS || 'services@codeuino.com';
5+
const SENDGRID_FROM_EMAIL_ADDRESS = process.env.SENDGRID_FROM_EMAIL_ADDRESS || 'services@codeuino.com'
66
sendgridMail.setApiKey(sendGridApi)
77

88
module.exports = {

app/controllers/user.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ module.exports = {
2424
// CREATE USER
2525
createUser: async (req, res, next) => {
2626
try {
27-
const { password } = req.body;
28-
if(!password) throw new Error("Password is required!")
27+
const { password } = req.body
28+
if(!password) throw new Error('Password is required!')
2929

3030
const user = new User(req.body)
3131
const isRegisteredUserExists = await User.findOne({ firstRegister: true })
@@ -51,7 +51,7 @@ module.exports = {
5151
await activity.save()
5252
// hide password
5353
user.password = undefined
54-
res.cookie("token", token, { httpOnly: true }).status(HttpStatus.CREATED).send({ user: user })
54+
res.cookie('token', token, { httpOnly: true }).status(HttpStatus.CREATED).send({ user: user })
5555
} catch (error) {
5656
return res.status(HttpStatus.NOT_ACCEPTABLE).json({ error: error })
5757
}
@@ -205,7 +205,7 @@ module.exports = {
205205
await req.user.save()
206206
// add all activity to db after successfully logged out
207207
activityHelper.addActivityToDb(req, res)
208-
res.clearCookie("token")
208+
res.clearCookie('token')
209209
return res.status(HttpStatus.OK).json({ msg: 'User logged out Successfully!' })
210210
} catch (error) {
211211
HANDLER.handleError(res, error)
@@ -508,7 +508,7 @@ module.exports = {
508508
})
509509
if (existingUser) {
510510
const token = await existingUser.generateAuthToken()
511-
return {token, user: existingUser};
511+
return {token, user: existingUser}
512512
} else {
513513
const newUser = new User(user)
514514
const isRegisteredUserExists = await User.findOne({ firstRegister: true })
@@ -535,7 +535,7 @@ module.exports = {
535535
return {token: token, user: data}
536536
}
537537
} catch(e) {
538-
throw e;
538+
throw e
539539
}
540540
}
541541
}

app/middleware/OAuthMiddlewares.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const passportGoogleAuthenticateCallback = async (req, res, next) => {
1515
if(details.token===undefined || !details.token) {
1616
res.redirect(afterAuthRedirect)
1717
}else {
18-
res.cookie("token", details.token, { httpOnly: true }).redirect(afterAuthRedirect);
18+
res.cookie('token', details.token, { httpOnly: true }).redirect(afterAuthRedirect)
1919
}
2020
})(req, res, next)
2121
}
@@ -34,7 +34,7 @@ const passportGitHubAuthenticateCallback = async (req, res, next) => {
3434
if(details.token===undefined || !details.token) {
3535
res.redirect(afterAuthRedirect)
3636
}else {
37-
res.cookie("token", details.token, { httpOnly: true }).redirect(afterAuthRedirect);
37+
res.cookie('token', details.token, { httpOnly: true }).redirect(afterAuthRedirect)
3838
}
3939
})(req, res, next)
4040
}

app/middleware/auth.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ const HttpStatus = require('http-status-codes')
44

55
const auth = async (req, res, next) => {
66
try {
7-
const token = req.cookies.token || '';
7+
const token = req.cookies.token || ''
88
if(!token) {
9-
throw Error("unauthorized access")
9+
throw Error('unauthorized access')
1010
}
1111
const decoded = jwt.verify(token, process.env.JWT_SECRET)
1212
const user = await User.findOne({

app/middleware/isOAuthAllowed.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const afterAuthRedirect = (process.env.clientbaseurl + '/login') || 'http://loc
44

55
const isOAuthAllowed = async (req, res, next) => {
66
try {
7-
const org = await Organisation.find({});
7+
const org = await Organisation.find({})
88
if (org.length === 0) {
99
return res.status(HttpStatus.NOT_FOUND).json({
1010
error: 'Organization does not exist!'
@@ -17,23 +17,23 @@ const isOAuthAllowed = async (req, res, next) => {
1717
}else {
1818
throw new Error('Google OAuth Not Allowed')
1919
}
20-
break;
20+
break
2121
}
2222
case 'github': {
2323
if(org[0].options.authentication.github) {
2424
next()
2525
}else {
2626
throw new Error('GitHub OAuth Not Allowed')
2727
}
28-
break;
28+
break
2929
}
3030
default: {
3131
if(org[0].options.authentication.email) {
3232
next()
3333
}else {
3434
throw new Error('Email Auth has beed turned off!')
3535
}
36-
break;
36+
break
3737
}
3838
}
3939
} catch (Error) {

app/middleware/passportOAuth.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ module.exports = {
1818
proxy: true
1919
}, (accessToken, refreshToken, profile, next) => {
2020

21-
const provider="google";
21+
const provider='google';
2222
user.findOrCreateForOAuth(profile, provider)
2323
.then(details => {
2424
if (details) {
2525
next(null, details);
2626
} else {
27-
next(null, false);
27+
next(null, false)
2828
}
2929
}).catch(err=>next(err))
30-
}));
30+
}))
3131
},
3232
initGitHubAuth: () => {
3333
passport.use(new GitHubStrategy({
@@ -37,15 +37,15 @@ module.exports = {
3737
proxy: true,
3838
scope: ['user:email']
3939
}, (accessToken, refreshToken, profile, next) => {
40-
const provider="github";
40+
const provider='github'
4141
user.findOrCreateForOAuth(profile, provider)
4242
.then(details => {
4343
if (details) {
44-
next(null, details);
44+
next(null, details)
4545
} else {
46-
next(null, false);
46+
next(null, false)
4747
}
4848
}).catch(err=>next(err))
49-
}));
49+
}))
5050
}
5151
}

app/utils/format-user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ module.exports = {
2525
isActivated: true
2626
}
2727
}
28-
return formattedUser;
28+
return formattedUser
2929
},
3030
}

0 commit comments

Comments
 (0)