GUAC-1176: Validate new password set due to expiration. Allow errors dialogs during login process.

This commit is contained in:
Michael Jumper
2015-06-03 16:04:44 -07:00
parent 85dae9e52a
commit 304e150a1e
5 changed files with 80 additions and 23 deletions

View File

@@ -26,6 +26,7 @@ import com.google.inject.Inject;
import com.google.inject.Provider;
import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import org.glyptodon.guacamole.GuacamoleClientException;
import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.form.Field;
import org.glyptodon.guacamole.net.auth.Credentials;
@@ -121,6 +122,14 @@ public class UserContextService {
throw new GuacamoleInsufficientCredentialsException("Password expired", EXPIRED_PASSWORD);
}
// New password must be different from old password
if (newPassword.equals(credentials.getPassword()))
throw new GuacamoleClientException("The new password must be different from the expired password.");
// New password must not be blank
if (newPassword.isEmpty())
throw new GuacamoleClientException("The new password may not be blank.");
// STUB: Change password if new password given
logger.info("Resetting expired password of user \"{}\".", user.getIdentifier());