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

Issue #SB-27131 fix: Log api error telemetry event when the user having not allowed special characters present in the username #25

Open
wants to merge 2 commits into
base: master
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
10 changes: 6 additions & 4 deletions library.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,12 @@
rolesEnabled: settings.rolesClaim && settings.rolesClaim.length !== 0,
isAdmin: false,
}, async (err, user) => {
const userSlug = await User.getUserField(user.uid, 'userslug');
console.log("'SB OIDC Token: userSlug-", userSlug);
console.log('SB OIDC Token: request original url:', req.originalUrl);
console.log('SB OIDC Token: request path url:', req.path);
console.log('SB OIDC Token: request url:', req.url);
console.log('SB OIDC Token: request protocol url:', req.protocol);
if(err && err === 'UserExists'){
const userSlug = await User.getUserField(user.uid, 'userslug');
response.responseCode = "CLIENT_ERROR";
response.responseCode = "400";
response.params.status = "unsuccessful";
Expand All @@ -120,6 +119,7 @@
console.log("SB OIDC Token: Error While checkig the tokens", error)
}
}else if(user){
const userSlug = await User.getUserField(user.uid, 'userslug');
response.responseCode = "OK"
response.params.status = "successful";
response.params.msg = "User created successful";
Expand All @@ -136,9 +136,11 @@
}else{
console.log("SB OIDC: Error Log for ", req.originalUrl)
response.responseCode = "SERVER_ERROR"
response.responseCode = "400"
response.responseCode = "400";
response.params.error = err.message;
console.log(err);
res.json(response);
res.status(400);
res.send(response);
}

});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nodebb-plugin-sunbird-oidc",
"version": "1.0.16",
"version": "1.0.17",
"description": "Authenticate to Sunbird identity provider.",
"main": "library.js",
"repository": {
Expand Down