diff --git a/README.md b/README.md index 28eb5da81..f399817d3 100644 --- a/README.md +++ b/README.md @@ -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 | ✅ | diff --git a/android/app/src/main/res/drawable-hdpi/icon_wordpress.png b/android/app/src/main/res/drawable-hdpi/icon_wordpress.png new file mode 100644 index 000000000..4dbc11e67 Binary files /dev/null and b/android/app/src/main/res/drawable-hdpi/icon_wordpress.png differ diff --git a/android/app/src/main/res/drawable-mdpi/icon_wordpress.png b/android/app/src/main/res/drawable-mdpi/icon_wordpress.png new file mode 100644 index 000000000..cc24baf40 Binary files /dev/null and b/android/app/src/main/res/drawable-mdpi/icon_wordpress.png differ diff --git a/android/app/src/main/res/drawable-xhdpi/icon_wordpress.png b/android/app/src/main/res/drawable-xhdpi/icon_wordpress.png new file mode 100644 index 000000000..e3457517b Binary files /dev/null and b/android/app/src/main/res/drawable-xhdpi/icon_wordpress.png differ diff --git a/android/app/src/main/res/drawable-xxhdpi/icon_wordpress.png b/android/app/src/main/res/drawable-xxhdpi/icon_wordpress.png new file mode 100644 index 000000000..82b896631 Binary files /dev/null and b/android/app/src/main/res/drawable-xxhdpi/icon_wordpress.png differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/icon_wordpress.png b/android/app/src/main/res/drawable-xxxhdpi/icon_wordpress.png new file mode 100644 index 000000000..6d7f42995 Binary files /dev/null and b/android/app/src/main/res/drawable-xxxhdpi/icon_wordpress.png differ diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index 718c73c7b..f77494c43 100644 --- a/app/lib/rocketchat.js +++ b/app/lib/rocketchat.js @@ -903,6 +903,8 @@ const RocketChat = { name, custom, showButton = true, service } = services; + const authName = name || service; + if (custom && showButton) { return 'oauth_custom'; } @@ -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 diff --git a/app/views/LoginSignupView.js b/app/views/LoginSignupView.js index 937596e55..c2711775a 100644 --- a/app/views/LoginSignupView.js +++ b/app/views/LoginSignupView.js @@ -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 { @@ -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]; } diff --git a/ios/RocketChatRN/Images.xcassets/Icons/icon_wordpress.imageset/Contents.json b/ios/RocketChatRN/Images.xcassets/Icons/icon_wordpress.imageset/Contents.json new file mode 100644 index 000000000..ff51ed6e3 --- /dev/null +++ b/ios/RocketChatRN/Images.xcassets/Icons/icon_wordpress.imageset/Contents.json @@ -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" + } +} \ No newline at end of file diff --git a/ios/RocketChatRN/Images.xcassets/Icons/icon_wordpress.imageset/iconWordpress.png b/ios/RocketChatRN/Images.xcassets/Icons/icon_wordpress.imageset/iconWordpress.png new file mode 100644 index 000000000..cc24baf40 Binary files /dev/null and b/ios/RocketChatRN/Images.xcassets/Icons/icon_wordpress.imageset/iconWordpress.png differ diff --git a/ios/RocketChatRN/Images.xcassets/Icons/icon_wordpress.imageset/iconWordpress@2x.png b/ios/RocketChatRN/Images.xcassets/Icons/icon_wordpress.imageset/iconWordpress@2x.png new file mode 100644 index 000000000..e3457517b Binary files /dev/null and b/ios/RocketChatRN/Images.xcassets/Icons/icon_wordpress.imageset/iconWordpress@2x.png differ diff --git a/ios/RocketChatRN/Images.xcassets/Icons/icon_wordpress.imageset/iconWordpress@3x.png b/ios/RocketChatRN/Images.xcassets/Icons/icon_wordpress.imageset/iconWordpress@3x.png new file mode 100644 index 000000000..82b896631 Binary files /dev/null and b/ios/RocketChatRN/Images.xcassets/Icons/icon_wordpress.imageset/iconWordpress@3x.png differ