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

package org.subethamail.web.action;

import lombok.Getter;
import lombok.Setter;

import org.hibernate.validator.constraints.Length;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.subethamail.entity.i.Validator;
import org.subethamail.web.Backend;
import org.subethamail.web.action.auth.AuthRequired;
import org.subethamail.web.model.ErrorMapModel;

/**
 * Changes a user's password.
 * 
 * @author Jon Stevens
 * @author Jeff Schnitzer
 */
public class UserChangePassword extends AuthRequired 
{
	/** */
	@SuppressWarnings("unused")
	private final static Logger log = LoggerFactory.getLogger(UserChangePassword.class);
	
	/** */
	public static class Model extends ErrorMapModel
	{
		/** */
		@Length(min=Validator.MIN_PERSON_PASSWORD, max=Validator.MAX_PERSON_PASSWORD)
		@Getter @Setter String password = "";

		/** Don't need to explicitly validate confirm because it must match password */
		@Getter @Setter String confirm = "";
	}

	/** */
	public void initialize()
	{
		this.getCtx().setModel(new Model());
	}
	
	/** */
	public void authExecute() throws Exception
	{
		Model model = (Model)this.getCtx().getModel();

		// Basic validation
		model.validate();
		
		if (!model.password.equals(model.confirm))
			model.setError("password", "The passwords do not match.");
			
		if (model.getErrors().isEmpty())
			Backend.instance().getAccountMgr().setPassword(model.password);
	}
}

@@ -107,16 +107,48 @@
 Setter;%0D
+%0Aimport lombok.extern.java.Log;%0D
 %0A%0D%0Aimpor
@@ -198,67 +198,8 @@
 h;%0D%0A
-import org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory;%0D%0A
 impo
@@ -477,16 +477,22 @@
 r%0D%0A */%0D%0A
+@Log%0D%0A
 public c
@@ -538,16 +538,16 @@
 uired %0D%0A
+
 %7B%0D%0A%09/** 
@@ -554,137 +554,8 @@
 */%0D%0A
-%09@SuppressWarnings(%22unused%22)%0D%0A%09private final static Logger log = LoggerFactory.getLogger(UserChangePassword.class);%0D%0A%09%0D%0A%09/** */%0D%0A
 %09pub

switch logging framework