This is an automated email from the git hooks/post-receive script. New commit to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git commit 81692d858876579e2e8c935a50bd6441f876fceb Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Mon May 11 16:41:13 2015 +0200 Fix the redirection when logging out --- .../java/org/nuiton/scmwebeditor/GitConnection.java | 11 ++++++----- .../nuiton/scmwebeditor/actions/BrowseAction.java | 5 +++++ .../nuiton/scmwebeditor/actions/LogoutAction.java | 2 +- .../resources/i18n/scmwebeditor_en_GB.properties | 1 + .../resources/i18n/scmwebeditor_fr_FR.properties | 1 + src/main/webapp/WEB-INF/content/logout.jsp | 8 ++++---- .../webapp/WEB-INF/content/privateScmRedirect.jsp | 20 +++++++++----------- src/main/webapp/css/main.css | 4 ++++ 8 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/nuiton/scmwebeditor/GitConnection.java b/src/main/java/org/nuiton/scmwebeditor/GitConnection.java index b2acf67..2aa166b 100644 --- a/src/main/java/org/nuiton/scmwebeditor/GitConnection.java +++ b/src/main/java/org/nuiton/scmwebeditor/GitConnection.java @@ -68,7 +68,8 @@ public class GitConnection implements ScmConnection { /** the id of the HTTP session */ protected String sessionId; - protected static final String MASTER_BRANCH = "master"; + /** the default branch to use when the requested one was not found */ + protected static final String DEFAULT_BRANCH = "master"; public GitConnection(String address, String sessionId) throws IOException { @@ -170,12 +171,12 @@ public class GitConnection implements ScmConnection { if (commitId == null) { if (log.isDebugEnabled()) { - log.debug("Branch " + selectedBranch + " was not found, using " + MASTER_BRANCH + " instead"); + log.debug("Branch " + selectedBranch + " was not found, using " + DEFAULT_BRANCH + " instead"); } - resultDto.setSelectedBranch(MASTER_BRANCH); - changeBranch(MASTER_BRANCH); - commitId = gitRepo.resolve(MASTER_BRANCH); + resultDto.setSelectedBranch(DEFAULT_BRANCH); + changeBranch(DEFAULT_BRANCH); + commitId = gitRepo.resolve(DEFAULT_BRANCH); } } } diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/BrowseAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/BrowseAction.java index a57bafa..5673d03 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/BrowseAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/BrowseAction.java @@ -168,6 +168,11 @@ public class BrowseAction extends AbstractScmWebEditorAction implements ServletR ScmConnection scmConn = provider.getConnection(address, sessionId); + if (scmConn == null) { + error = true; + return ROOT; + } + // putting all the parameters into a DTO BrowseDto dto = new BrowseDto(); dto.setUsername(username); diff --git a/src/main/java/org/nuiton/scmwebeditor/actions/LogoutAction.java b/src/main/java/org/nuiton/scmwebeditor/actions/LogoutAction.java index 3dde582..46eb571 100644 --- a/src/main/java/org/nuiton/scmwebeditor/actions/LogoutAction.java +++ b/src/main/java/org/nuiton/scmwebeditor/actions/LogoutAction.java @@ -73,7 +73,7 @@ public class LogoutAction extends AbstractScmWebEditorAction implements ServletR // getting the repository unique identifier if it is possible String repositoryId = scmConn.getRepositoryId(); if (repositoryId == null) { - repositoryId = address; + repositoryId = address.replace(' ', '_'); } // deleting the cookies for this repository diff --git a/src/main/resources/i18n/scmwebeditor_en_GB.properties b/src/main/resources/i18n/scmwebeditor_en_GB.properties index 36b8f8a..38a32f0 100644 --- a/src/main/resources/i18n/scmwebeditor_en_GB.properties +++ b/src/main/resources/i18n/scmwebeditor_en_GB.properties @@ -56,6 +56,7 @@ scm.saveAndQuit=Save and quit scm.saveAndQuitTitle=Save this file and go back to previous page. scm.showDiff=Show differences scm.stayLogin=Keep me logged +scm.submit=Submit scm.text=Text scm.thankUsing=Thank you using SCMWebEditor scm.upload=Upload diff --git a/src/main/resources/i18n/scmwebeditor_fr_FR.properties b/src/main/resources/i18n/scmwebeditor_fr_FR.properties index 7945e9a..944f445 100644 --- a/src/main/resources/i18n/scmwebeditor_fr_FR.properties +++ b/src/main/resources/i18n/scmwebeditor_fr_FR.properties @@ -56,6 +56,7 @@ scm.saveAndQuit=Sauvegarder et quitter scm.saveAndQuitTitle=Sauvegarder le fichier sur le dépôt et retourner à la page précédente. scm.showDiff=Voir les differences scm.stayLogin=Rester connecté +scm.submit=Envoyer scm.text=Texte scm.thankUsing=merci d'avoir utilisé SCMWebEditor scm.upload=Ajouter un fichier diff --git a/src/main/webapp/WEB-INF/content/logout.jsp b/src/main/webapp/WEB-INF/content/logout.jsp index 9035585..5f117e3 100644 --- a/src/main/webapp/WEB-INF/content/logout.jsp +++ b/src/main/webapp/WEB-INF/content/logout.jsp @@ -34,10 +34,10 @@ <% if (request.getAttribute("projectUrl") != null) { %> <meta http-equiv="Refresh" - content="0;URL=checkout.action?address=<%=request.getAttribute("address")%>&projectUrl=<%=request.getAttribute("projectUrl")%>&scmType=<%=request.getAttribute("scmType")%>"> + content="0;URL=edit.action?address=<%=request.getAttribute("address")%>&projectUrl=<%=request.getAttribute("projectUrl")%>&scmType=<%=request.getAttribute("scmType")%>"> <% } else { %> <meta http-equiv="Refresh" - content="0;URL=checkout.action?address=<%=request.getAttribute("address")%>&scmType=<%=request.getAttribute("scmType")%>"> + content="0;URL=edit.action?address=<%=request.getAttribute("address")%>&scmType=<%=request.getAttribute("scmType")%>"> <% } %> @@ -48,9 +48,9 @@ <p><s:text name="scm.logoutWait"/><a - href="checkout.action?address=<%=request.getAttribute("address")%>&scmType=<%=request.getAttribute("scmType")%>"> <s:text + href="edit.action?address=<%=request.getAttribute("address")%>&scmType=<%=request.getAttribute("scmType")%>"> <s:text name="scm.clickHere"/> </a>.</p> -<p>©2004-2014 CodeLutin</p> +<p>©2004-2015 CodeLutin</p> </body> </html> diff --git a/src/main/webapp/WEB-INF/content/privateScmRedirect.jsp b/src/main/webapp/WEB-INF/content/privateScmRedirect.jsp index 6b8c57e..7e40212 100644 --- a/src/main/webapp/WEB-INF/content/privateScmRedirect.jsp +++ b/src/main/webapp/WEB-INF/content/privateScmRedirect.jsp @@ -43,14 +43,9 @@ Author : glorieux --%> value="<%=request.getAttribute("address")%>"/> <input type="hidden" name="fromLoginPage" value="true"> - <% if (request.getAttribute("projectUrl") != null) { %> - <input type="hidden" name="ProjectUrl" - value="<%=request.getAttribute("projectUrl")%>"/> - <% } else { %> - <input type="hidden" name="ProjectUrl" value="checkout.action"/> - <% } %> + <input type="hidden" id="ProjectUrl" name="ProjectUrl" value="checkout.action"/> - <script src="cancelRedirect.js"></script> + <script src="js/cancelRedirect.js"></script> <p><s:text name="scm.privateScmAccess"/></p> <p><label ACCESSKEY=U><s:text name="scm.username"/> : <input TYPE=text @@ -58,14 +53,17 @@ Author : glorieux --%> SIZE=12></label> <label ACCESSKEY=P><s:text name="scm.password"/> : <input TYPE=password NAME=pw SIZE=12></label> - <input type="checkbox" name="saveCookie" value="true">Rester connecté + <label><input type="checkbox" name="saveCookie" value="true"><s:text name="scm.stayLogin"/></label> </p> <s:hidden name="scmType" value="%{scmType}" id="scmType"/> + <s:set id="submit"> + <s:text name="scm.submit"/> + </s:set> - <input type="submit" name="Save"/> + <s:submit id="submitPrivateScm" name="Save" value="%{submit}"/> <s:set id="scm.exit"> @@ -75,9 +73,9 @@ Author : glorieux --%> <s:text name="scm.exitJavascript"/> </s:set> <s:submit type="button" value="%{scm.exit}" name="exitLogin" - onclick="return cancelRedirect('%{scm.exitJavascript}',this.form.ProjectUrl);"/> + onclick="return cancelRedirect('%{scm.exitJavascript}',document.getElementById('ProjectUrl'));"/> </form> -<p>©2004-2014 CodeLutin</p> +<p>©2004-2015 CodeLutin</p> </body> </html> diff --git a/src/main/webapp/css/main.css b/src/main/webapp/css/main.css index a459f34..848f6b4 100644 --- a/src/main/webapp/css/main.css +++ b/src/main/webapp/css/main.css @@ -377,4 +377,8 @@ ul.flags li { #previewPosition { margin-top: 14px; margin-bottom: 14px; +} + +#wwctrl_submitPrivateScm { + display: inline; } \ No newline at end of file -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.