diff --git a/src/main/java/org/ntlab/nemophila/resources/accounts/LoginRest.java b/src/main/java/org/ntlab/nemophila/resources/accounts/LoginRest.java index 3fb4a2a..f696126 100644 --- a/src/main/java/org/ntlab/nemophila/resources/accounts/LoginRest.java +++ b/src/main/java/org/ntlab/nemophila/resources/accounts/LoginRest.java @@ -1,5 +1,9 @@ package org.ntlab.nemophila.resources.accounts; +import org.ntlab.nemophila.models.accounts.Account; +import org.ntlab.nemophila.models.accounts.AccountManager; + +import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @@ -8,7 +12,16 @@ public class LoginRest { @POST @Path("/{uid}/login") - public String getAccounts(@PathParam("uid") String uid, String pw) { - return null; + public Account getAccounts(@FormParam("uid") String uid, @FormParam("pw") String pw) { + AccountManager am = AccountManager.getInstance(); + Account account = am.getAccount(uid); + + if (account.getPw().equals(pw)) { + account = am.updateAccount(uid); + } else { + System.out.println("Error : Miss match pw"); + } + + return account; } }