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

[NEW] Option to hide the button of Custom OAuth on login screen #15053

Merged
merged 2 commits into from
Aug 19, 2019
Merged
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
4 changes: 3 additions & 1 deletion app/lib/server/methods/addOAuthService.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/lib/server/startup/oAuthServicesUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function _OAuthServicesUpdate() {
data.rolesClaim = settings.get(`${ service.key }-roles_claim`);
data.mergeUsers = settings.get(`${ service.key }-merge_users`);
data.mergeRoles = settings.get(`${ service.key }-merge_roles`);
data.showButton = settings.get(`${ service.key }-show_button`);
new CustomOAuth(serviceName.toLowerCase(), {
serverURL: data.serverURL,
tokenPath: data.tokenPath,
Expand All @@ -68,6 +69,7 @@ function _OAuthServicesUpdate() {
mergeUsers: data.mergeUsers,
mergeRoles: data.mergeRoles,
accessTokenParam: data.accessTokenParam,
showButton: data.showButton,
});
}
if (serviceName === 'Facebook') {
Expand Down
27 changes: 13 additions & 14 deletions app/ui-login/client/login/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,42 @@ Meteor.startup(function() {

Template.loginServices.helpers({
loginService() {
const services = [];
const authServices = ServiceConfiguration.configurations.find({}, {
return ServiceConfiguration.configurations.find({
showButton: { $ne: false },
}, {
sort: {
service: 1,
},
}).fetch();
authServices.forEach(function(service) {
}).fetch().map(function(service) {
let icon;
let serviceName;
let displayName;
switch (service.service) {
case 'meteor-developer':
serviceName = 'Meteor';
displayName = 'Meteor';
icon = 'meteor';
break;
case 'github':
serviceName = 'GitHub';
displayName = 'GitHub';
icon = 'github-circled';
break;
case 'gitlab':
serviceName = 'GitLab';
displayName = 'GitLab';
icon = service.service;
break;
case 'wordpress':
serviceName = 'WordPress';
displayName = 'WordPress';
icon = service.service;
break;
default:
serviceName = s.capitalize(service.service);
displayName = s.capitalize(service.service);
icon = service.service;
}
return services.push({
return {
service,
displayName: serviceName,
displayName,
icon,
});
};
});
return services;
},
});

Expand Down
1 change: 1 addition & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"Accounts_OAuth_Custom_Access_Token_Param": "Param Name for access token",
"Accounts_OAuth_Custom_Scope": "Scope",
"Accounts_OAuth_Custom_Secret": "Secret",
"Accounts_OAuth_Custom_Show_Button_On_Login_Page": "Show Button on Login Page",
"Accounts_OAuth_Custom_Token_Path": "Token Path",
"Accounts_OAuth_Custom_Token_Sent_Via": "Token Sent Via",
"Accounts_OAuth_Custom_Username_Field": "Username field",
Expand Down