Repository: openmeetings
Updated Branches:
  refs/heads/master b9e491ad0 -> 9bb9c3650


[OPENMEETINGS-1717] FB login is tested, UI is improved


Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/9bb9c365
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/9bb9c365
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/9bb9c365

Branch: refs/heads/master
Commit: 9bb9c36507af5fe122aef5ea27507d2a1cee8a51
Parents: b9e491a
Author: Maxim Solodovnik <[email protected]>
Authored: Thu Oct 19 18:16:23 2017 +0700
Committer: Maxim Solodovnik <[email protected]>
Committed: Thu Oct 19 18:16:23 2017 +0700

----------------------------------------------------------------------
 .../installation/ImportInitvalues.java          |  4 +-
 .../web/pages/auth/SignInDialog.html            |  4 +-
 .../web/pages/auth/SignInDialog.java            | 10 ++---
 .../openmeetings/web/pages/auth/SignInPage.java | 39 ++++++++++----------
 .../src/main/webapp/css/general.css             | 10 +++++
 5 files changed, 39 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/9bb9c365/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
 
b/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
index fbc7cf5..1617fbf 100644
--- 
a/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
+++ 
b/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
@@ -471,8 +471,8 @@ public class ImportInitvalues {
                facebookServer.setEnabled(false);
                facebookServer.setClientId(CLIENT_PLACEHOLDER);
                facebookServer.setClientSecret(SECRET_PLACEHOLDER);
-               
facebookServer.setRequestKeyUrl("https://www.facebook.com/dialog/oauth?client_id={$client_id}&redirect_uri={$redirect_uri}&scope=email";);
-               
facebookServer.setRequestTokenUrl("https://graph.facebook.com/v2.3/oauth/access_token";);
+               
facebookServer.setRequestKeyUrl("https://www.facebook.com/v2.10/dialog/oauth?client_id={$client_id}&redirect_uri={$redirect_uri}&scope=email";);
+               
facebookServer.setRequestTokenUrl("https://graph.facebook.com/v2.10/oauth/access_token";);
                facebookServer.setRequestTokenMethod(RequestMethod.POST);
                
facebookServer.setRequestTokenAttributes("client_id={$client_id}&redirect_uri={$redirect_uri}&client_secret={$client_secret}&code={$code}");
                
facebookServer.setRequestInfoUrl("https://graph.facebook.com/me?access_token={$access_token}&fields=id,first_name,last_name,email";);

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/9bb9c365/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.html
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.html
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.html
index 885b3f9..ceb809d 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.html
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.html
@@ -48,9 +48,9 @@
                                                </tr>
                                        </table>
                                </td>
-                               <td wicket:id="oauthContainer" 
style="border-left: 2px dotted;">
+                               <td wicket:id="oauthContainer" 
class="oauth-section">
                                        <div wicket:id="oauthList">
-                                               <button 
wicket:id="oauthBtn"><img wicket:id="icon" width="16" height="16"/><span 
wicket:id="label"></span></button>
+                                               <button 
wicket:id="oauthBtn"><span class="provider" wicket:id="label"></span></button>
                                        </div>
                                </td>
                        </tr>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/9bb9c365/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.java
index 24892ca..55e3a35 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInDialog.java
@@ -60,7 +60,6 @@ import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.form.PasswordTextField;
 import org.apache.wicket.markup.html.form.RequiredTextField;
 import org.apache.wicket.markup.html.form.StatelessForm;
-import org.apache.wicket.markup.html.image.Image;
 import org.apache.wicket.markup.html.link.Link;
 import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.markup.html.list.ListView;
@@ -282,10 +281,11 @@ public class SignInDialog extends 
NonClosableDialog<String> {
                                                                showAuth(s);
                                                        }
                                                };
-                                               Component icon = new 
Image("icon", Model.of(""))
-                                                               
.setVisible(!Strings.isEmpty(s.getIconUrl()))
-                                                               
.add(AttributeModifier.replace("src", s.getIconUrl()));
-                                               btn.add(icon, new 
Label("label", s.getName()));
+                                               Component lbl = new 
Label("label", s.getName());
+                                               if 
(!Strings.isEmpty(s.getIconUrl())) {
+                                                       
lbl.add(AttributeModifier.replace("style", String.format("background-image: 
url(%s)", s.getIconUrl())));
+                                               }
+                                               btn.add(lbl);
                                                
item.add(btn.setDefaultFormProcessing(false)); //skip all rules, go to redirect
                                        }
                                }).setVisible(allowOAuthLogin()));

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/9bb9c365/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInPage.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInPage.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInPage.java
index dc7622b..4dcecc1 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInPage.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/pages/auth/SignInPage.java
@@ -64,6 +64,7 @@ import org.apache.wicket.util.string.StringValue;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
 
+import com.github.openjson.JSONException;
 import com.github.openjson.JSONObject;
 
 public class SignInPage extends BaseInitedPage {
@@ -102,7 +103,7 @@ public class SignInPage extends BaseInitedPage {
                                } else { // redirect to get code
                                        showAuth(server);
                                }
-                       } catch (IOException|NoSuchAlgorithmException e) {
+                       } catch 
(IOException|NoSuchAlgorithmException|JSONException e) {
                                log.error("OAuth2 login error", e);
                        }
                }
@@ -243,18 +244,18 @@ public class SignInPage extends BaseInitedPage {
                String sourceResponse = 
IOUtils.toString(urlConnection.getInputStream(), UTF_8);
                // parse json result
                AuthInfo result = new AuthInfo();
-               JSONObject jsonResult = new JSONObject(sourceResponse);
-               if (jsonResult.has("access_token")) {
-                       result.accessToken = 
jsonResult.getString("access_token");
+               JSONObject json = new JSONObject(sourceResponse);
+               if (json.has("access_token")) {
+                       result.accessToken = json.getString("access_token");
                }
-               if (jsonResult.has("refresh_token")) {
-                       result.refreshToken = 
jsonResult.getString("refresh_token");
+               if (json.has("refresh_token")) {
+                       result.refreshToken = json.getString("refresh_token");
                }
-               if (jsonResult.has("token_type")) {
-                       result.tokenType = jsonResult.getString("token_type");
+               if (json.has("token_type")) {
+                       result.tokenType = json.getString("token_type");
                }
-               if (jsonResult.has("expires_in")) {
-                       result.expiresIn = jsonResult.getLong("expires_in");
+               if (json.has("expires_in")) {
+                       result.expiresIn = json.getLong("expires_in");
                }
                // access token must be specified
                if (result.accessToken == null) {
@@ -266,8 +267,8 @@ public class SignInPage extends BaseInitedPage {
 
        private static Map<String, String> getAuthParams(String token, String 
code, OAuthServer server) throws IOException {
                // get attributes names
-               String loginAttributeName = server.getLoginParamName();
-               String emailAttributeName = server.getEmailParamName();
+               String login = server.getLoginParamName();
+               String email = server.getEmailParamName();
                String firstname = server.getFirstnameParamName();
                String lastname = server.getLastnameParamName();
                // prepare url
@@ -280,14 +281,14 @@ public class SignInPage extends BaseInitedPage {
                String sourceResponse = 
IOUtils.toString(connection.getInputStream(), UTF_8);
                // parse json result
                Map<String, String> result = new HashMap<>();
-               JSONObject parsedJson = new JSONObject(sourceResponse);
-               result.put("login", parsedJson.getString(loginAttributeName));
-               result.put("email", parsedJson.getString(emailAttributeName));
-               if (parsedJson.has(firstname)) {
-                       result.put("firstname", 
parsedJson.getString(firstname));
+               JSONObject json = new JSONObject(sourceResponse);
+               result.put("login", json.getString(login));
+               result.put("email", json.getString(email));
+               if (json.has(firstname)) {
+                       result.put("firstname", json.getString(firstname));
                }
-               if (parsedJson.has(lastname)) {
-                       result.put("lastname", parsedJson.getString(lastname));
+               if (json.has(lastname)) {
+                       result.put("lastname", json.getString(lastname));
                }
                return result;
        }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/9bb9c365/openmeetings-web/src/main/webapp/css/general.css
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/webapp/css/general.css 
b/openmeetings-web/src/main/webapp/css/general.css
index b0f066a..ccbbf75 100644
--- a/openmeetings-web/src/main/webapp/css/general.css
+++ b/openmeetings-web/src/main/webapp/css/general.css
@@ -24,6 +24,16 @@ html, body {
 * {
        box-sizing: initial; /*reset bootstrap box sizing*/
 }
+.signin .oauth-section {
+       border-left: 2px dotted;
+       padding-left: 5px;
+}
+.signin .oauth-section .provider {
+       background-position: 0 0;
+       background-size: 16px;
+       background-repeat: no-repeat;
+       padding-left: 20px;
+}
 #header {
        font-size: 28px;
        line-height: 40px;

Reply via email to