From 3286926d2ec11445f76cd170e4c2fcff597a0754 Mon Sep 17 00:00:00 2001
From: Fabrice Bacchella <fbacchella@spamcop.net>
Date: Tue, 26 May 2015 04:48:40 -0400
Subject: [PATCH] Two slight improvement for custom UserService: - try userRealm as a file only if class is not found, other exeptions are real error - log userService only after setup, for better logging, as it can use gitblit.properties for custom .toString
---
src/main/java/com/gitblit/transport/ssh/WelcomeShell.java | 27 +++++++++++++++++----------
1 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/gitblit/transport/ssh/WelcomeShell.java b/src/main/java/com/gitblit/transport/ssh/WelcomeShell.java
index a9fe6f0..852756a 100644
--- a/src/main/java/com/gitblit/transport/ssh/WelcomeShell.java
+++ b/src/main/java/com/gitblit/transport/ssh/WelcomeShell.java
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2009 The Android Open Source Project
* Copyright 2014 gitblit.com.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -134,8 +135,10 @@
msg.append(user.getDisplayName());
msg.append(", you have successfully connected over SSH.");
msg.append(nl);
+ msg.append(" Interactive shells are not available.");
msg.append(nl);
- msg.append(" client: ");
+ msg.append(nl);
+ msg.append(" client: ");
msg.append(session.getClientVersion());
msg.append(nl);
msg.append(nl);
@@ -156,17 +159,21 @@
msg.append(nl);
msg.append(nl);
- msg.append(" You may upload an SSH public key with the following syntax:");
- msg.append(nl);
- msg.append(nl);
+ if (client.getKey() == null) {
+ // user has authenticated with a password
+ // display add public key instructions
+ msg.append(" You may upload an SSH public key with the following syntax:");
+ msg.append(nl);
+ msg.append(nl);
- msg.append(String.format(" cat ~/.ssh/id_rsa.pub | ssh -l %s -p %d %s gitblit keys add -", user.username, port, hostname));
- msg.append(nl);
- msg.append(nl);
+ msg.append(String.format(" cat ~/.ssh/id_rsa.pub | ssh -l %s -p %d %s keys add", user.username, port, hostname));
+ msg.append(nl);
+ msg.append(nl);
- msg.append(b2);
- msg.append(nl);
- msg.append(nl);
+ msg.append(b2);
+ msg.append(nl);
+ msg.append(nl);
+ }
// display the core commands
SshCommandFactory cmdFactory = (SshCommandFactory) session.getFactoryManager().getCommandFactory();
--
Gitblit v1.9.1