Skip to content

Codereview#2 of 9 (Valente) from 6 (Furlan)#136

Open
AlbVal97 wants to merge 1 commit intoPrandiniUniPD:CommonDemofrom
AlbVal97:discussionForumValenteReview1
Open

Codereview#2 of 9 (Valente) from 6 (Furlan)#136
AlbVal97 wants to merge 1 commit intoPrandiniUniPD:CommonDemofrom
AlbVal97:discussionForumValenteReview1

Conversation

@AlbVal97
Copy link
Copy Markdown
Collaborator

Hello @GiovanniFurlan ,
I kindly ask you to review part of the code I have sent to you.
To be specific, I need the classes ForumLogin.java and Login_VM.java to be reviewed, with the exception of the brief parts of Login_VM.java that only belong to @TaulantBullaku .
They are responsible for performing the login request to the database and then launch the fragments useful to access the forum content.

Thanks a lot for your time!
Alberto

* ***************************
*/

private OnFragmentInteractionListener mListener;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable is never initialized and use, i think u can delete it

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right: I think I forgot to delete it after the recent refactoring, so I'll get it done.

{
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont understand the meaning of this interface. Is that used somewhere? Does it needs to be completed? Otherwise i suggest u to delete it or at least complete the TODO.

Copy link
Copy Markdown
Collaborator Author

@AlbVal97 AlbVal97 Jan 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the fact that it is linked to the first variable and it is never used (nor in @leopardo-rossi-developer class, which I used as an example) I think that I can safely delete it too.

// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see some hardcoding, i suggest u to use the file strings.xml in resources to save your strings and then retrieve it when need. I see some case in line 41-46-51-56-169

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for pointing them out! I definitely forgot to use resources for line 169 and I didn't even recognized as hardcoding the other four.


//The username and password inserted are gathered from the EditText objects
userName = usernameEditText.getText().toString();
userPwd = pwdEditText.getText().toString();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that could be better to not let the password as a normal string in the code for security reason. i suggest u to cript it before use and send it to Login_VM. i know this is a base implementation so this is an advice for future improvement.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're totally right: I'm going to implement this as soon as possible because, as you said, is a fairly basic security issue.

/**
* String used to identify the error given by incorrect credentials
*/
private final String LOG_INCORRECT_CREDENTIALS = "Connection established. Credentials refused.";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variables in line 62 and 67 is never used, i think u forgot to delete them

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, I'm going to fix them. Thank you!


//Sends a netword request to check if the provided credentials are correct
DatabaseManager.loginUser(context, username, password, listeners);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there are a lot of listeners, i suggest you to use different names to differentiate them. I had some difficulties to recognize them.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right: I have replaced them with "forumLoginListeners" instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants