Skip to content

Commit f3cf90f

Browse files
committed
Update null checks
1 parent 5ff877a commit f3cf90f

File tree

8 files changed

+36
-34
lines changed

8 files changed

+36
-34
lines changed

coral/types/api.d.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -2709,7 +2709,7 @@ export type components = {
27092709
mailid?: string;
27102710
username: string;
27112711
role: string;
2712-
userPassword?: string;
2712+
userPassword: string;
27132713
/** Format: int32 */
27142714
teamId: number;
27152715
switchTeams: boolean;
@@ -2903,7 +2903,7 @@ export type components = {
29032903
};
29042904
RegisterUserInfoModel: {
29052905
username: string;
2906-
pwd?: string;
2906+
pwd: string;
29072907
team?: string;
29082908
/** Format: int32 */
29092909
teamId?: number;
@@ -3091,8 +3091,8 @@ export type components = {
30913091
includeOnlyFailedTasks: boolean;
30923092
};
30933093
ChangePasswordRequestModel: {
3094-
pwd?: string;
3095-
repeatPwd?: string;
3094+
pwd: string;
3095+
repeatPwd: string;
30963096
};
30973097
Env: {
30983098
id?: string;
@@ -3147,7 +3147,7 @@ export type components = {
31473147
clusterName: string;
31483148
bootstrapServers: string;
31493149
/** @enum {string} */
3150-
protocol: "PLAINTEXT" | "SSL" | "SASL_PLAIN" | "SASL_SSL_PLAIN_MECHANISM" | "SASL_SSL_GSSAPI_MECHANISM" | "SASL_SSL_SCRAM_MECHANISM_256" | "SASL_SSL_SCRAM_MECHANISM_512";
3150+
protocol: "SSL" | "SASL_PLAIN" | "SASL_SSL_PLAIN_MECHANISM" | "SASL_SSL_GSSAPI_MECHANISM" | "SASL_SSL_SCRAM_MECHANISM_256" | "SASL_SSL_SCRAM_MECHANISM_512" | "PLAINTEXT";
31513151
/** @enum {string} */
31523152
clusterType: "ALL" | "KAFKA" | "SCHEMA_REGISTRY" | "KAFKA_CONNECT";
31533153
/** @enum {string} */
@@ -3807,7 +3807,7 @@ export type components = {
38073807
clusterName: string;
38083808
bootstrapServers: string;
38093809
/** @enum {string} */
3810-
protocol: "PLAINTEXT" | "SSL" | "SASL_PLAIN" | "SASL_SSL_PLAIN_MECHANISM" | "SASL_SSL_GSSAPI_MECHANISM" | "SASL_SSL_SCRAM_MECHANISM_256" | "SASL_SSL_SCRAM_MECHANISM_512";
3810+
protocol: "SSL" | "SASL_PLAIN" | "SASL_SSL_PLAIN_MECHANISM" | "SASL_SSL_GSSAPI_MECHANISM" | "SASL_SSL_SCRAM_MECHANISM_256" | "SASL_SSL_SCRAM_MECHANISM_512" | "PLAINTEXT";
38113811
/** @enum {string} */
38123812
clusterType: "ALL" | "KAFKA" | "SCHEMA_REGISTRY" | "KAFKA_CONNECT";
38133813
/** @enum {string} */

core/src/main/java/io/aiven/klaw/helpers/KwConstants.java

+3
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,7 @@ public class KwConstants {
156156
public static final String USER_DELETION_MAIL_TEXT = "Hello, user %s deleted by user %s.";
157157

158158
public static final String PASSWORD_REGEX = "(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[\\W_]).{8,}";
159+
160+
public static final String PASSWORD_REGEX_VALIDATION_STR =
161+
"Password must be at least 8 characters long and include at least one uppercase letter, one lowercase letter, one number, and one special character.";
159162
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package io.aiven.klaw.model.requests;
22

33
import static io.aiven.klaw.helpers.KwConstants.PASSWORD_REGEX;
4+
import static io.aiven.klaw.helpers.KwConstants.PASSWORD_REGEX_VALIDATION_STR;
45

6+
import jakarta.validation.constraints.NotNull;
57
import jakarta.validation.constraints.Pattern;
68
import java.io.Serializable;
79
import lombok.AllArgsConstructor;
@@ -13,15 +15,11 @@
1315
@NoArgsConstructor
1416
public class ChangePasswordRequestModel implements Serializable {
1517

16-
@Pattern(
17-
regexp = PASSWORD_REGEX,
18-
message =
19-
"Password must be at least 8 characters long and include at least one uppercase letter, one lowercase letter, one number, and one special character.")
18+
@NotNull
19+
@Pattern(regexp = PASSWORD_REGEX, message = PASSWORD_REGEX_VALIDATION_STR)
2020
String pwd;
2121

22-
@Pattern(
23-
regexp = PASSWORD_REGEX,
24-
message =
25-
"Password must be at least 8 characters long and include at least one uppercase letter, one lowercase letter, one number, and one special character.")
22+
@NotNull
23+
@Pattern(regexp = PASSWORD_REGEX, message = PASSWORD_REGEX_VALIDATION_STR)
2624
String repeatPwd;
2725
}

core/src/main/java/io/aiven/klaw/model/requests/RegisterUserInfoModel.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.aiven.klaw.model.requests;
22

33
import static io.aiven.klaw.helpers.KwConstants.PASSWORD_REGEX;
4+
import static io.aiven.klaw.helpers.KwConstants.PASSWORD_REGEX_VALIDATION_STR;
45

56
import jakarta.validation.constraints.Email;
67
import jakarta.validation.constraints.NotNull;
@@ -22,10 +23,8 @@ public class RegisterUserInfoModel implements Serializable {
2223
@NotNull(message = "Username cannot be null")
2324
private String username;
2425

25-
@Pattern(
26-
regexp = PASSWORD_REGEX,
27-
message =
28-
"Password must be at least 8 characters long and include at least one uppercase letter, one lowercase letter, one number, and one special character.")
26+
@Pattern(regexp = PASSWORD_REGEX, message = PASSWORD_REGEX_VALIDATION_STR)
27+
@NotNull
2928
private String pwd;
3029

3130
private String team;

core/src/main/java/io/aiven/klaw/model/requests/UserInfoModel.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.aiven.klaw.model.requests;
22

33
import static io.aiven.klaw.helpers.KwConstants.PASSWORD_REGEX;
4+
import static io.aiven.klaw.helpers.KwConstants.PASSWORD_REGEX_VALIDATION_STR;
45

56
import jakarta.validation.constraints.NotNull;
67
import jakarta.validation.constraints.Pattern;
@@ -22,10 +23,8 @@ public class UserInfoModel extends ProfileModel implements Serializable {
2223

2324
@NotNull private String role;
2425

25-
@Pattern(
26-
regexp = PASSWORD_REGEX,
27-
message =
28-
"Password must be at least 8 characters long and include at least one uppercase letter, one lowercase letter, one number, and one special character.")
26+
@Pattern(regexp = PASSWORD_REGEX, message = PASSWORD_REGEX_VALIDATION_STR)
27+
@NotNull
2928
private String userPassword;
3029

3130
@NotNull private Integer teamId;

core/src/main/resources/static/js/manageUsers.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ app.controller("manageUsersCtrl", function($scope, $http, $location, $window) {
109109

110110
$scope.chPwd = function() {
111111

112-
var serviceInput = {};
113-
114-
serviceInput['pwd'] = $scope.chPwd.pwd;
115-
serviceInput['repeatPwd'] = $scope.chPwd.repeatpwd;
116-
117112
if(!$scope.chPwd.pwd) {
118113
$scope.alertnote = "Please enter a suggested password.";
119114
$scope.showAlertToast();
@@ -134,6 +129,11 @@ app.controller("manageUsersCtrl", function($scope, $http, $location, $window) {
134129
return;
135130
}
136131

132+
var serviceInput = {};
133+
134+
serviceInput['pwd'] = $scope.chPwd.pwd;
135+
serviceInput['repeatPwd'] = $scope.chPwd.repeatpwd;
136+
137137
swal({
138138
title: "Are you sure?",
139139
text: "You would like to Change password?",

core/src/main/resources/templates/addUser.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -504,11 +504,13 @@ <h4 class="mb-3">Shortcuts</h4>
504504
<div class="col-md-6">
505505
<div class="form-group">
506506
<label>Password</label>
507-
<input type="password" class="form-control"
507+
<input type="password"
508+
class="form-control"
508509
minlength="8"
509510
required ng-model="addNewUser.pwd"
510511
pattern="(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).{8,}"
511-
title="Password must be at least 8 characters long and include at least one uppercase letter, one lowercase letter, one number, and one special character."
512+
title="Password must be at least 8 characters long and include at least one
513+
uppercase letter, one lowercase letter, one number, and one special character."
512514
/>
513515
</div>
514516
</div>

openapi.yaml

+6-5
Original file line numberDiff line numberDiff line change
@@ -5934,7 +5934,7 @@
59345934
"format" : "int32"
59355935
}
59365936
},
5937-
"required" : [ "fullname", "role", "switchTeams", "teamId", "username" ]
5937+
"required" : [ "fullname", "role", "switchTeams", "teamId", "userPassword", "username" ]
59385938
},
59395939
"TopicConfigEntry" : {
59405940
"properties" : {
@@ -6517,7 +6517,7 @@
65176517
"type" : "string"
65186518
}
65196519
},
6520-
"required" : [ "fullname", "username" ]
6520+
"required" : [ "fullname", "pwd", "username" ]
65216521
},
65226522
"SchemaPromotion" : {
65236523
"properties" : {
@@ -7000,7 +7000,8 @@
70007000
"type" : "string",
70017001
"pattern" : "(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[\\W_]).{8,}"
70027002
}
7003-
}
7003+
},
7004+
"required" : [ "pwd", "repeatPwd" ]
70047005
},
70057006
"Env" : {
70067007
"properties" : {
@@ -7160,7 +7161,7 @@
71607161
},
71617162
"protocol" : {
71627163
"type" : "string",
7163-
"enum" : [ "PLAINTEXT", "SSL", "SASL_PLAIN", "SASL_SSL_PLAIN_MECHANISM", "SASL_SSL_GSSAPI_MECHANISM", "SASL_SSL_SCRAM_MECHANISM_256", "SASL_SSL_SCRAM_MECHANISM_512" ]
7164+
"enum" : [ "SSL", "SASL_PLAIN", "SASL_SSL_PLAIN_MECHANISM", "SASL_SSL_GSSAPI_MECHANISM", "SASL_SSL_SCRAM_MECHANISM_256", "SASL_SSL_SCRAM_MECHANISM_512", "PLAINTEXT" ]
71647165
},
71657166
"clusterType" : {
71667167
"type" : "string",
@@ -9042,7 +9043,7 @@
90429043
},
90439044
"protocol" : {
90449045
"type" : "string",
9045-
"enum" : [ "PLAINTEXT", "SSL", "SASL_PLAIN", "SASL_SSL_PLAIN_MECHANISM", "SASL_SSL_GSSAPI_MECHANISM", "SASL_SSL_SCRAM_MECHANISM_256", "SASL_SSL_SCRAM_MECHANISM_512" ]
9046+
"enum" : [ "SSL", "SASL_PLAIN", "SASL_SSL_PLAIN_MECHANISM", "SASL_SSL_GSSAPI_MECHANISM", "SASL_SSL_SCRAM_MECHANISM_256", "SASL_SSL_SCRAM_MECHANISM_512", "PLAINTEXT" ]
90469047
},
90479048
"clusterType" : {
90489049
"type" : "string",

0 commit comments

Comments
 (0)