Skip to content

Commit

Permalink
Merge pull request #262 from AY2122S1-CS2103T-W13-2/jiahao/UGDG-update
Browse files Browse the repository at this point in the history
Add PasswordCommand sequence diagram
  • Loading branch information
huizhuansam authored Nov 7, 2021
2 parents 32f6acc + 72520ec commit 5a41aae
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 3 deletions.
8 changes: 7 additions & 1 deletion docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,16 @@ The system first checks if the password is valid. This is due to the fact that t

The user can change the password if they wish. The diagram below summarises the workflow.

![Change password diagram](images/FlowChangePassword.png)
![Change password activity diagram](images/FlowChangePassword.png)

The `PasswordCommandParser` checks the format and the validity of the new password. Then, the `LogicManager` will check if the old password supplied is correct. If the old password is correct, the `Encryption` in `LogicManager` will be updated and the data file will be encrypted with the new `Encryption`. This enables the changing of password.

The Sequence Diagram below illustrates the interactions within the Logic component for changing a password. Note that some parts are omitted for simplicity.

![PasswordCommand diagram](images/PasswordCommandSequenceDiagram.png)

The PasswordCommand is executed by a special `executePasswordCommand` method. Two `EncryptionManager` are created, each corresponds to one password. The one for the old password will be used to decrypt the data file. The one for the new password will be used to encrypt the decrypted data file. The decrypted data file is then removed. This completes the process of changing password.

### Find feature

#### Implementation
Expand Down
2 changes: 1 addition & 1 deletion docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ The flags used in `password` are as follows:
password
```

Do note that the password needs to be between **8** and **32** characters (inclusive) long.
Do note that the password needs to be between **8** and **32** (inclusive) ASCII characters.

The prohibited characters are : `/`, `-`. Note that password cannot contain blank space.

Expand Down
52 changes: 52 additions & 0 deletions docs/diagrams/PasswordCommandSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@startuml
!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
end box

box Encryption
participant "temp:EncryptionManager" as EncryptionManager1 ENCRYPTION_COLOR
participant "new:EncryptionManager" as EncryptionManager2 ENCRYPTION_COLOR
end box

participant "<color:#red>**<<class>>**\n<color:#black>FileUtil" as FileUtil

[-> LogicManager : executePasswordCommand(...)
activate LogicManager

create EncryptionManager1
LogicManager -> EncryptionManager1
activate EncryptionManager1

EncryptionManager1 --> LogicManager
deactivate EncryptionManager1

create EncryptionManager2
LogicManager -> EncryptionManager2
activate EncryptionManager2

EncryptionManager2 --> LogicManager
deactivate EncryptionManager2

LogicManager -> EncryptionManager1 : decrypt()
activate EncryptionManager1

EncryptionManager1 --> LogicManager
deactivate EncryptionManager1

LogicManager -> EncryptionManager2 : encrypt()
activate EncryptionManager2

EncryptionManager2 --> LogicManager
deactivate EncryptionManager2

LogicManager -> FileUtil : deleteFile()
activate FileUtil

FileUtil --> LogicManager
deactivate FileUtil

[<--LogicManager
deactivate LogicManager
@enduml
Binary file added docs/images/PasswordCommandSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/team/zhou-jiahao-1998.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Given below are my contributions to the project.
* **New Feature**: Encryption integration
* What it does: allows SPAM to read and write from the encrypted file.
* Justification: This feature makes sure that the data file stays encrypted at all times.
* Credits: Pair programming with @huizhuansam.
* Credits: Pair programming with [@huizhuansam](https://github.com/huizhuansam).


* **New Feature**: Password protection
Expand Down

0 comments on commit 5a41aae

Please sign in to comment.