-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix url in password reset email #12078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
067a1cc
859f765
911bb60
538344d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,21 +16,28 @@ | |
| // under the License. | ||
| package com.cloud.utils.server; | ||
|
|
||
| import com.cloud.utils.PropertiesUtil; | ||
| import com.cloud.utils.crypt.EncryptionSecretKeyChecker; | ||
| import com.cloud.utils.StringUtils; | ||
| import org.apache.commons.io.IOUtils; | ||
| import org.apache.logging.log4j.Logger; | ||
| import org.apache.logging.log4j.LogManager; | ||
|
|
||
| import java.io.File; | ||
| import java.io.FileInputStream; | ||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.util.Properties; | ||
|
|
||
| public class ServerProperties { | ||
| protected Logger logger = LogManager.getLogger(getClass()); | ||
|
|
||
| public static final String HTTPS_ENABLE = "https.enable"; | ||
| public static final String KEYSTORE_FILE = "https.keystore"; | ||
| public static final String PASSWORD_ENCRYPTION_TYPE = "password.encryption.type"; | ||
|
|
||
| private static Properties properties = new Properties(); | ||
| private static boolean loaded = false; | ||
| public static final String passwordEncryptionType = "password.encryption.type"; | ||
|
|
||
| public synchronized static Properties getServerProperties(InputStream inputStream) { | ||
| if (!loaded) { | ||
|
|
@@ -39,7 +46,7 @@ public synchronized static Properties getServerProperties(InputStream inputStrea | |
| serverProps.load(inputStream); | ||
|
|
||
| EncryptionSecretKeyChecker checker = new EncryptionSecretKeyChecker(); | ||
| checker.check(serverProps, passwordEncryptionType); | ||
| checker.check(serverProps, PASSWORD_ENCRYPTION_TYPE); | ||
|
|
||
| if (EncryptionSecretKeyChecker.useEncryption()) { | ||
| EncryptionSecretKeyChecker.decryptAnyProperties(serverProps); | ||
|
|
@@ -56,4 +63,25 @@ public synchronized static Properties getServerProperties(InputStream inputStrea | |
|
|
||
| return properties; | ||
| } | ||
|
|
||
| public static boolean isHttpsEnabled() { | ||
|
||
| final File confFile = PropertiesUtil.findConfigFile("server.properties"); | ||
| if (confFile == null) { | ||
| return false; | ||
| } | ||
|
|
||
| try { | ||
| InputStream is = new FileInputStream(confFile); | ||
| final Properties properties = ServerProperties.getServerProperties(is); | ||
| if (properties == null) { | ||
| return false; | ||
| } | ||
|
|
||
| boolean httpsEnable = Boolean.parseBoolean(properties.getProperty(HTTPS_ENABLE, "false")); | ||
| String keystoreFile = properties.getProperty(KEYSTORE_FILE); | ||
| return httpsEnable && StringUtils.isNotEmpty(keystoreFile) && new File(keystoreFile).exists(); | ||
| } catch (final IOException e) { | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.