2
0
Fork 0
mirror of https://github.com/discourse/wp-discourse.git synced 2025-10-03 08:59:21 +08:00

style settings errors

This commit is contained in:
scossar 2016-05-22 03:35:49 -07:00
parent 7d10d9e68e
commit 7347cc26ad
2 changed files with 4 additions and 2 deletions

View file

@ -9,7 +9,8 @@
#setting-error-min_trust_level ~ form #discourse_min-trust-level,
#setting-error-bypass_trust_level ~ form #discourse_bypass-trust-level-score,
#setting-error-excerpt_length ~ form #discourse_custom-excerpt-length,
#setting-error-sso_secret ~ form #discourse_sso-secret {
#setting-error-sso_secret ~ form #discourse_sso-secret,
#setting-error-login_path ~ form #discourse_login-path {
border-color: #dc3232;
border-width: 2px;
}

View file

@ -291,7 +291,8 @@ class SettingsValidator {

public function validate_login_path( $input ) {
if ( $this->sso_enabled && $input ) {
$regex = '/$(\/[a-z0-9\-]*)*/';
// todo: improve regex
$regex = '/^\/([a-z0-9\-]*)*/';
if ( ! preg_match( $regex, $input ) ) {
add_settings_error( 'discourse', 'login_path', __( 'You have given an invalid file path', 'wp-discourse' ) );
return $this->sanitize_text( $input );