Skip to content

Commit

Permalink
authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
dmittrey committed Oct 1, 2021
1 parent aad8298 commit e4531bb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Server/src/main/java/utility/Invoker.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ public Receiver getReceiver() {

public Response execute(Request aRequest) {
String aCommand = aRequest.getCommand().getCommand();
TypeOfSession typeOfSession = aRequest.getSession().getTypeOfSession();
String username = aRequest.getSession().getName();
String password = aRequest.getSession().getPassword();
if (typeOfSession.equals(TypeOfSession.Register) ^ receiver.loginUser(username, password)) {
if (aCommand.equals("register") || receiver.loginUser(username, password)) {
return commands.get(aCommand).execute(aRequest);
} else return new Response(TypeOfAnswer.NOTMATCH);
}
Expand Down

0 comments on commit e4531bb

Please sign in to comment.