Skip to content

Commit

Permalink
Bug fix: when creating new users with username being a email id as pa…
Browse files Browse the repository at this point in the history
…ttern (#2363)

* Fix saas pattern

Signed-off-by: Muralidhar Basani <[email protected]>

* Fix saas pattern

Signed-off-by: Muralidhar Basani <[email protected]>

* Fix variable

Signed-off-by: Muralidhar Basani <[email protected]>

---------

Signed-off-by: Muralidhar Basani <[email protected]>
  • Loading branch information
muralibasani authored Mar 21, 2024
1 parent 191919e commit ce51b80
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 2.8.0
version = 2.8.1
NODE = node

# Sets a custom hook path in the local git config.
Expand Down
2 changes: 1 addition & 1 deletion bin/run-klaw.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SET CURRENTDIR="%cd%"
set DIR=%~dp0..\
cd %DIR%

set version=2.8.0
set version=2.8.1
set core_lib=.\core\target\klaw-%version%.jar
set cluster_lib=.\cluster-api\target\cluster-api-%version%.jar
set core_config=.\core\target\classes\application.properties
Expand Down
2 changes: 1 addition & 1 deletion bin/run-klaw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKING_DIR="$(dirname "$0")"/..
cd $WORKING_DIR

# Declarations
version=2.8.0
version=2.8.1
core_lib=./core/target/klaw-${version}.jar
cluster_lib=./cluster-api/target/cluster-api-${version}.jar
core_config=./core/target/classes/application.properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class UsersTeamsControllerService {
public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
public static final String MASKED_PWD = "********";
public static final String UNUSED_PASSWD = "unusedpasswd";
private static final Pattern emailUsernamePattern = Pattern.compile("^[A-Za-z0-9+_.-]+@(.+)$");

@Value("${klaw.login.authentication.type}")
private String authenticationType;
Expand Down Expand Up @@ -1096,8 +1097,9 @@ private Object getPrincipal() {
}

private boolean userNamePatternValidation(String userName) {
Matcher m1 = defaultPattern.matcher(userName);
return m1.matches();
Matcher m1 = emailUsernamePattern.matcher(userName);
Matcher m2 = defaultPattern.matcher(userName);
return m1.matches() || m2.matches();
}

public List<TeamModelResponse> getSwitchTeams(String userId) {
Expand Down
2 changes: 1 addition & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"name" : "Apache 2.0",
"url" : "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"version" : "2.8.0"
"version" : "2.8.1"
},
"externalDocs" : {
"description" : "Klaw documentation",
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</parent>

<properties>
<revision>2.8.0</revision>
<revision>2.8.1</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>17</java.version>
Expand Down

0 comments on commit ce51b80

Please sign in to comment.