-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Updated login and update password APIs (#4751)
* fix: Added error response in createUser API Signed-off-by: Hrishav <[email protected]> * fix: added project ID to update password mutation Signed-off-by: Hrishav <[email protected]> * fix: fixed failing UTs Signed-off-by: Hrishav <[email protected]> --------- Signed-off-by: Hrishav <[email protected]>
- Loading branch information
1 parent
a02767d
commit 7503f0d
Showing
14 changed files
with
160 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -490,7 +490,7 @@ func TestUpdatePassword(t *testing.T) { | |
givenStrictPassword: false, | ||
givenServiceResponse: nil, | ||
expectedCode: http.StatusOK, | ||
expectedOutput: `{"message":"password has been updated successfully"}`, | ||
expectedOutput: `{"message":"password has been updated successfully","projectID":"someProjectID"}`, | ||
}, | ||
{ | ||
name: "Invalid new password", | ||
|
@@ -524,9 +524,19 @@ func TestUpdatePassword(t *testing.T) { | |
Email: "[email protected]", | ||
IsInitialLogin: false, | ||
} | ||
userFromDB := &entities.User{ | ||
ID: "testUserID", | ||
Username: "testUser", | ||
Password: "hashedPassword", | ||
Email: "[email protected]", | ||
} | ||
service.On("FindUserByUsername", "testUser").Return(userFromDB, nil) | ||
service.On("GetUser", "testUID").Return(user, nil) | ||
service.On("UpdatePassword", &userPassword, true).Return(tt.givenServiceResponse) | ||
|
||
project := &entities.Project{ | ||
ID: "someProjectID", | ||
} | ||
service.On("GetOwnerProjectIDs", mock.Anything, "testUserID").Return([]*entities.Project{project}, nil) | ||
rest.UpdatePassword(service)(c) | ||
|
||
assert.Equal(t, tt.expectedCode, w.Code) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
chaoscenter/web/src/api/auth/schemas/ResponseErrBadRequest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable */ | ||
// This code is autogenerated using @harnessio/oats-cli. | ||
// Please do not modify this code directly. | ||
|
||
export interface ResponseErrBadRequest { | ||
/** | ||
* @example "The old and new passwords can't be same" | ||
*/ | ||
error?: string; | ||
/** | ||
* @example "The old and new passwords can't be same" | ||
*/ | ||
errorDescription?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
chaoscenter/web/src/views/CreateNewUser/CreateNewUser.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.passwordField { | ||
margin-bottom: 15px !important; | ||
} |
9 changes: 9 additions & 0 deletions
9
chaoscenter/web/src/views/CreateNewUser/CreateNewUser.module.scss.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
declare namespace CreateNewUserModuleScssNamespace { | ||
export interface ICreateNewUserModuleScss { | ||
passwordField: string; | ||
} | ||
} | ||
|
||
declare const CreateNewUserModuleScssModule: CreateNewUserModuleScssNamespace.ICreateNewUserModuleScss; | ||
|
||
export = CreateNewUserModuleScssModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters