Skip to content

Commit

Permalink
[NEW] Wordpress auth (#1633)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolmello authored Jan 29, 2020
1 parent 514e73c commit d2df4c6
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Readme will guide you on how to config.
| Accessibility (Medium) | ❌ |
| Accessibility (Advanced) | ❌ |
| Authentication via Meteor | ❌ |
| Authentication via Wordpress | |
| Authentication via Wordpress | |
| Authentication via Custom OAuth | ✅ |
| Add user to the room | ✅ |
| Send message | ✅ |
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions app/lib/rocketchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,8 @@ const RocketChat = {
name, custom, showButton = true, service
} = services;

const authName = name || service;

if (custom && showButton) {
return 'oauth_custom';
}
Expand All @@ -916,8 +918,8 @@ const RocketChat = {
}

// TODO: remove this after other oauth providers are implemented. e.g. Drupal, github_enterprise
const availableOAuth = ['facebook', 'github', 'gitlab', 'google', 'linkedin', 'meteor-developer', 'twitter'];
return availableOAuth.includes(name) ? 'oauth' : 'not_supported';
const availableOAuth = ['facebook', 'github', 'gitlab', 'google', 'linkedin', 'meteor-developer', 'twitter', 'wordpress'];
return availableOAuth.includes(authName) ? 'oauth' : 'not_supported';
},
getUsernameSuggestion() {
// RC 0.65.0
Expand Down
14 changes: 13 additions & 1 deletion app/views/LoginSignupView.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,17 @@ class LoginSignupView extends React.Component {
this.openOAuth({ url });
}

onPressWordpress = () => {
const { services, server } = this.props;
const { clientId, serverURL } = services.wordpress;
const endpoint = `${ serverURL }/oauth/authorize`;
const redirect_uri = `${ server }/_oauth/wordpress?close`;
const scope = 'openid';
const state = this.getOAuthState();
const params = `?client_id=${ clientId }&redirect_uri=${ redirect_uri }&scope=${ scope }&state=${ state }&response_type=code`;
this.openOAuth({ url: `${ endpoint }${ params }` });
}

onPressCustomOAuth = (loginService) => {
const { server } = this.props;
const {
Expand Down Expand Up @@ -314,7 +325,8 @@ class LoginSignupView extends React.Component {
google: this.onPressGoogle,
linkedin: this.onPressLinkedin,
'meteor-developer': this.onPressMeteor,
twitter: this.onPressTwitter
twitter: this.onPressTwitter,
wordpress: this.onPressWordpress
};
return oauthProviders[name];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "iconWordpress.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "iconWordpress@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "iconWordpress@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d2df4c6

Please sign in to comment.