/*
Copyright (C) 2005 David Green <green@couchpotato.net>
All Rights Reserved.

This file is part of Aelfengard.

Aelfengard is proprietary software. You may not redistribute it without
prior written permission from the copyright holder.
*/

package server.login;

public class ChoosePasswordStep {

    private final LoginHandler handler;
    
    public ChoosePasswordStep(LoginHandler handler) {
        this.handler = handler;
    }
    
    public String run() throws Exception {
        handler.sendPasswordMode(true);
        while (true){
            handler.println(false, "");
            handler.println(false, "Please choose a password?");
            String password = handler.readLine();
            handler.println(false, "Please enter that password again?");
            if (password.equals(handler.readLine())) {
                handler.sendPasswordMode(false);
                return password;
            }
            handler.println(false, "@30FThose passwords don't match. Please try again.");
        }
    }
    
}