Skip to content

Commit

Permalink
Merge pull request docker#198 from markperdue/master
Browse files Browse the repository at this point in the history
typo fix for com.docker.UserSignup.util.Rot13
  • Loading branch information
spara authored Mar 18, 2017
2 parents 09edb3d + 7223ede commit 5c4b20f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions developer-tools/java-debugging/Eclipse-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,28 @@ Try to log into the application. Look at the value for password in the Eclipse v

In this MVC application the UserController uses the findByLogin method in the UserServiceImpl class which uses the findByUsername method to retrieve the information from the database. It then checks to see if the password from the form matches the user password. Since the password from the login form is not scrambled using ROT13, it does not match the user password and you cannot log into the application.

To fix this, apply ROT13 to the password by adding
To fix this, apply ROT13 to the password by adding an import near the top of the file

```
import com.docker.UserSignup.utit.Rot13
import com.docker.UserSignup.util.Rot13
```

and replace the contents of `findByLogin` with

String passwd = Rot13.rot13(password);
```
public boolean findByLogin(String userName, String password) {
User usr = userRepository.findByUserName(userName);
String passwd = Rot13.rot13(password);
if(usr != null && usr.getPassword().equals(passwd)) {
return true;
}
return false;
}
```

![](images/eclipse_debug_UserServiceImpl_code.png)

Set a breakpoint in UserServiceImpl on the findByLogin method. Log in again and look at the values for the breakpoint. The 'passwd' variable is `z0ol` which matches the password for the user moby.
Expand Down

0 comments on commit 5c4b20f

Please sign in to comment.