/*
 * $Id$
 * $URL$
 */

package org.subethamail.web.action;

import lombok.Getter;
import lombok.Setter;

import org.hibernate.validator.constraints.Email;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.subethamail.common.NotFoundException;
import org.subethamail.web.Backend;
import org.subethamail.web.action.auth.AuthAction;
import org.subethamail.web.model.ErrorMapModel;

/**
 * Sends a password reminder back to the email owner.
 * 
 * @author Jeff Schnitzer
 */
public class ForgotPassword extends AuthAction 
{
	/** */
	@SuppressWarnings("unused")
	private final static Logger log = LoggerFactory.getLogger(ForgotPassword.class);
	
	/** */
	public static class Model extends ErrorMapModel
	{
		@Email
		@Getter @Setter String email;
	}
	
	/** */
	public void initialize()
	{
		this.getCtx().setModel(new Model());
	}
	
	/** */
	public void execute() throws Exception
	{
		Model model = (Model)this.getCtx().getModel();
		
		model.validate();
		
		if (model.getErrors().isEmpty())
		{
			try
			{
				Backend.instance().getAccountMgr().forgotPassword(model.email);
			}
			catch (NotFoundException ex)
			{
				model.setError("email", "Unknown email address");
			}
		}
	}
	
}

@@ -165,67 +165,8 @@
 l;%0D%0A
-import org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory;%0D%0A
 impo
@@ -513,133 +513,8 @@
 */%0D%0A
-%09@SuppressWarnings(%22unused%22)%0D%0A%09private final static Logger log = LoggerFactory.getLogger(ForgotPassword.class);%0D%0A%09%0D%0A%09/** */%0D%0A
 %09pub

switch logging framework