| 1 | |
package org.paneris.bibliomania; |
| 2 | |
|
| 3 | |
import org.melati.Melati; |
| 4 | |
import org.melati.servlet.Form; |
| 5 | |
import org.melati.poem.PoemThread; |
| 6 | |
import org.webmacro.WebMacroException; |
| 7 | |
import org.webmacro.servlet.WebContext; |
| 8 | |
|
| 9 | 0 | public class UserDetails extends BibliomaniaServlet { |
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
private static final long serialVersionUID = 1L; |
| 15 | |
|
| 16 | |
protected void fillContext(Melati melati, BibContext it) { |
| 17 | 0 | it.setLogicalDatabase("bibliomania"); |
| 18 | 0 | } |
| 19 | |
|
| 20 | |
protected String bibliomaniaHandle(Melati melati, WebContext context) |
| 21 | |
throws WebMacroException { |
| 22 | 0 | if (melati.getUser() == melati.getDatabase().guestAccessToken()) |
| 23 | 0 | throw new NotLoggedInException(); |
| 24 | 0 | else if (context.getForm("field_password") == null) |
| 25 | 0 | return bibliomaniaTemplate("bibliomanialogin/Details.wm"); |
| 26 | |
else { |
| 27 | 0 | User user = (User)PoemThread.accessToken(); |
| 28 | 0 | Form.extractFields(melati.getServletTemplateContext(), user); |
| 29 | 0 | user.setLogin(user.getEmail()); |
| 30 | 0 | return bibliomaniaTemplate("bibliomanialogin/DetailsSuccess.wm"); |
| 31 | |
} |
| 32 | |
} |
| 33 | |
} |