-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 9.2
-
Fix Version/s: 9.10
-
Component/s: nuxeoctl start/stop/admin
-
Tags:
-
Sprint:NOS 9.10.2
-
Story Points:1
Context
A new instance can be registered via nuxeoctl in interactive mode, by providing only the username:
./bin/nuxeoctl register <username>
Then, the server will invite you to enter your password once you pressed the "ENTER" key. Everything works fine if you provide a valid password. However, there're two problems during the process:
- It's not clear the first argument is username.
- When the username or password is incorrect, nuxeoctl returns a long HTML page, which is completely incomprehensible.
Point 1: awesome = username or project?
nuxeo-server-9.2-tomcat $ ./bin/nuxeoctl register awesome Detected Tomcat server. Nuxeo home: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat Nuxeo configuration: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/bin/nuxeo.conf Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/common-base Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/common Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/default Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/sql Please enter your password:
Point 2: Entering a wrong password or nonexistent username crashes nuxeoctl
nuxeo-server-9.2-tomcat $ ./bin/nuxeoctl register toto Detected Tomcat server. Nuxeo home: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat Nuxeo configuration: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/bin/nuxeo.conf Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/common-base Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/common Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/default Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/sql Please enter your password: Cannot execute command. org.json.JSONException: A JSONArray text must start with '[' at character 9 of <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Nuxeo • Connect – Customer Portal</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css" media="screen">@import 'css/cas.css?version=20120510'/**/;</style> <!--[if gte IE 6]><style type="text/css" media="screen">@import 'css/ie_cas.css';</style><![endif]--> <link rel="icon" href="/cas/favicon.png" type="image/x-icon" /> </head> <body id="cas"> <div id="header"> <div class="logo"> <a href="https://connect.nuxeo.com/nuxeo"> <img alt="Nuxeo Connect" src="images/logo_connect_white.png"> </a> </div> <div class="labelCorp"> <ul> <li> <a href="http://www.nuxeo.com/"> nuxeo.com </a> </li> </ul> <div style="clear: both;"></div> </div> </div> <div id="content"> <table width="100%" height="87%"> <tr> <td align="center"> <form id="fm1" class="fm-v clearfix" action="/cas/login;jsessionid=812D62444A4438C87D20CB22DD28858E?service=https%3A%2F%2Fconnect.nuxeo.com%2Fnuxeo%2Fsite%2Fconnect-gateway%2FgetAvailableProjectsForRegistration" method="post"> <div class="box" id="login"> <div class="row id-field"> <label for="username"> Username </label> <input id="username" name="username" class="required" tabindex="1" accesskey="u" type="text" value="" autocomplete="false"/> <script type="text/javascript"> document.getElementById('username').focus(); </script> </div> <div class="row id-field"> <label for="password"> Password </label> <input id="password" name="password" class="required" tabindex="2" accesskey="p" type="password" value="" autocomplete="on"/> <a class="btn-reset password" href="https://connect.nuxeo.com/nuxeo/site/connect/user/lostPassword"> Forgotten password? </a> </div> <div class="row btn-row"> <input type="hidden" name="lt" value="LT-520580-LVxAcLgcOEkRojVyQlikGAi4zB4apb-cas01.example.org" /> <input type="hidden" name="execution" value="e1s1" /> <input type="hidden" name="_eventId" value="submit" /> <input class="btn-submit" name="submit" accesskey="l" value="LOGIN" tabindex="4" type="submit" /> </div> <div class="row alt-signin"> <a id="btn-google2Client" href="https://accounts.google.com/o/oauth2/auth?client_id=540832103590-bao3da4os29ne0c61nift6e3rn0k8tiu.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fsso.nuxeo.com%2Fcas%2Flogin%3Fclient_name%3DGoogle2Client&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&response_type=code"><img alt="login with Google" src="images/White-signin-Long-base-44dp.png" /></a> </div> </div> </form> </td> <td width="400px"> <iframe src="https://www.nuxeo.com/embedded/dm-login" onload="javascript:this.style.visibility='visible';" style="visibility: visible;" id="block_container"></iframe> </td> </tr> </table> </div> <div id="footer"> <div id="copyrights"> <span>Copyright © 2015-2017 Nuxeo and respective authors. </span> <span>| Powered by <a href="http://www.ja-sig.org/products/cas/">JA-SIG Central Authentication Service</a>, <a href="http://www.nuxeo.com">Nuxeo.com</a></span> </div> </div> </body> </html> java.lang.RuntimeException: org.json.JSONException: A JSONArray text must start with '[' at character 9 of <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Nuxeo • Connect – Customer Portal</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css" media="screen">@import 'css/cas.css?version=20120510'/**/;</style> <!--[if gte IE 6]><style type="text/css" media="screen">@import 'css/ie_cas.css';</style><![endif]--> <link rel="icon" href="/cas/favicon.png" type="image/x-icon" /> </head> <body id="cas"> <div id="header"> <div class="logo"> <a href="https://connect.nuxeo.com/nuxeo"> <img alt="Nuxeo Connect" src="images/logo_connect_white.png"> </a> </div> <div class="labelCorp"> <ul> <li> <a href="http://www.nuxeo.com/"> nuxeo.com </a> </li> </ul> <div style="clear: both;"></div> </div> </div> <div id="content"> <table width="100%" height="87%"> <tr> <td align="center"> <form id="fm1" class="fm-v clearfix" action="/cas/login;jsessionid=812D62444A4438C87D20CB22DD28858E?service=https%3A%2F%2Fconnect.nuxeo.com%2Fnuxeo%2Fsite%2Fconnect-gateway%2FgetAvailableProjectsForRegistration" method="post"> <div class="box" id="login"> <div class="row id-field"> <label for="username"> Username </label> <input id="username" name="username" class="required" tabindex="1" accesskey="u" type="text" value="" autocomplete="false"/> <script type="text/javascript"> document.getElementById('username').focus(); </script> </div> <div class="row id-field"> <label for="password"> Password </label> <input id="password" name="password" class="required" tabindex="2" accesskey="p" type="password" value="" autocomplete="on"/> <a class="btn-reset password" href="https://connect.nuxeo.com/nuxeo/site/connect/user/lostPassword"> Forgotten password? </a> </div> <div class="row btn-row"> <input type="hidden" name="lt" value="LT-520580-LVxAcLgcOEkRojVyQlikGAi4zB4apb-cas01.example.org" /> <input type="hidden" name="execution" value="e1s1" /> <input type="hidden" name="_eventId" value="submit" /> <input class="btn-submit" name="submit" accesskey="l" value="LOGIN" tabindex="4" type="submit" /> </div> <div class="row alt-signin"> <a id="btn-google2Client" href="https://accounts.google.com/o/oauth2/auth?client_id=540832103590-bao3da4os29ne0c61nift6e3rn0k8tiu.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fsso.nuxeo.com%2Fcas%2Flogin%3Fclient_name%3DGoogle2Client&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&response_type=code"><img alt="login with Google" src="images/White-signin-Long-base-44dp.png" /></a> </div> </div> </form> </td> <td width="400px"> <iframe src="https://www.nuxeo.com/embedded/dm-login" onload="javascript:this.style.visibility='visible';" style="visibility: visible;" id="block_container"></iframe> </td> </tr> </table> </div> <div id="footer"> <div id="copyrights"> <span>Copyright © 2015-2017 Nuxeo and respective authors. </span> <span>| Powered by <a href="http://www.ja-sig.org/products/cas/">JA-SIG Central Authentication Service</a>, <a href="http://www.nuxeo.com">Nuxeo.com</a></span> </div> </div> </body> </html> at org.nuxeo.connect.registration.RegistrationHelper.getAvailableProjectsForRegistration(RegistrationHelper.java:142) at org.nuxeo.connect.connector.service.ConnectGatewayComponent.getAvailableProjectsForRegistration(ConnectGatewayComponent.java:120) at org.nuxeo.launcher.connect.ConnectRegistrationBroker.getAvailableProjects(ConnectRegistrationBroker.java:178) at org.nuxeo.launcher.NuxeoLauncher.registerRemoteInstance(NuxeoLauncher.java:1543) at org.nuxeo.launcher.NuxeoLauncher.launch(NuxeoLauncher.java:1260) at org.nuxeo.launcher.NuxeoLauncher.main(NuxeoLauncher.java:1106) Caused by: org.json.JSONException: A JSONArray text must start with '[' at character 9 of <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Nuxeo • Connect – Customer Portal</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css" media="screen">@import 'css/cas.css?version=20120510'/**/;</style> <!--[if gte IE 6]><style type="text/css" media="screen">@import 'css/ie_cas.css';</style><![endif]--> <link rel="icon" href="/cas/favicon.png" type="image/x-icon" /> </head> <body id="cas"> <div id="header"> <div class="logo"> <a href="https://connect.nuxeo.com/nuxeo"> <img alt="Nuxeo Connect" src="images/logo_connect_white.png"> </a> </div> <div class="labelCorp"> <ul> <li> <a href="http://www.nuxeo.com/"> nuxeo.com </a> </li> </ul> <div style="clear: both;"></div> </div> </div> <div id="content"> <table width="100%" height="87%"> <tr> <td align="center"> <form id="fm1" class="fm-v clearfix" action="/cas/login;jsessionid=812D62444A4438C87D20CB22DD28858E?service=https%3A%2F%2Fconnect.nuxeo.com%2Fnuxeo%2Fsite%2Fconnect-gateway%2FgetAvailableProjectsForRegistration" method="post"> <div class="box" id="login"> <div class="row id-field"> <label for="username"> Username </label> <input id="username" name="username" class="required" tabindex="1" accesskey="u" type="text" value="" autocomplete="false"/> <script type="text/javascript"> document.getElementById('username').focus(); </script> </div> <div class="row id-field"> <label for="password"> Password </label> <input id="password" name="password" class="required" tabindex="2" accesskey="p" type="password" value="" autocomplete="on"/> <a class="btn-reset password" href="https://connect.nuxeo.com/nuxeo/site/connect/user/lostPassword"> Forgotten password? </a> </div> <div class="row btn-row"> <input type="hidden" name="lt" value="LT-520580-LVxAcLgcOEkRojVyQlikGAi4zB4apb-cas01.example.org" /> <input type="hidden" name="execution" value="e1s1" /> <input type="hidden" name="_eventId" value="submit" /> <input class="btn-submit" name="submit" accesskey="l" value="LOGIN" tabindex="4" type="submit" /> </div> <div class="row alt-signin"> <a id="btn-google2Client" href="https://accounts.google.com/o/oauth2/auth?client_id=540832103590-bao3da4os29ne0c61nift6e3rn0k8tiu.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fsso.nuxeo.com%2Fcas%2Flogin%3Fclient_name%3DGoogle2Client&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&response_type=code"><img alt="login with Google" src="images/White-signin-Long-base-44dp.png" /></a> </div> </div> </form> </td> <td width="400px"> <iframe src="https://www.nuxeo.com/embedded/dm-login" onload="javascript:this.style.visibility='visible';" style="visibility: visible;" id="block_container"></iframe> </td> </tr> </table> </div> <div id="footer"> <div id="copyrights"> <span>Copyright © 2015-2017 Nuxeo and respective authors. </span> <span>| Powered by <a href="http://www.ja-sig.org/products/cas/">JA-SIG Central Authentication Service</a>, <a href="http://www.nuxeo.com">Nuxeo.com</a></span> </div> </div> </body> </html> at org.json.JSONTokener.syntaxError(JSONTokener.java:450) at org.json.JSONArray.<init>(JSONArray.java:108) at org.json.JSONArray.<init>(JSONArray.java:147) at org.nuxeo.connect.registration.RegistrationHelper.getAvailableProjectsForRegistration(RegistrationHelper.java:132) ... 5 more
Expected Results
For the point 1, tell user the 1st argument is recognized as username:
Show username before asking password
nuxeo-server-9.2-tomcat $ ./bin/nuxeoctl register awesome Detected Tomcat server. Nuxeo home: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat Nuxeo configuration: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/bin/nuxeo.conf Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/common-base Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/common Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/default Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/sql Username: awesome Please enter your password:
For the point 2, tell user that the credentials is invalid.
Do not show any HTML content
nuxeo-server-9.2-tomcat $ ./bin/nuxeoctl register toto Detected Tomcat server. Nuxeo home: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat Nuxeo configuration: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/bin/nuxeo.conf Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/common-base Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/common Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/default Include template: /Users/mincong/Downloads/nuxeo-server-9.2-tomcat/templates/sql Please enter your password: Invalid credentials. Please try again.