<commit_before>package org.arisgames.editor.forms
{
import flash.events.MouseEvent;
import mx.containers.Panel;
import mx.controls.Alert;
import mx.controls.Button;
import mx.controls.LinkButton;
import mx.controls.RadioButtonGroup;
import mx.controls.TextInput;
import mx.events.FlexEvent;
import mx.rpc.Responder;

import org.arisgames.editor.models.StateModel;
import org.arisgames.editor.services.AppServices;
import org.arisgames.editor.util.AppConstants;

public class ForgotAccountInformationFormView extends Panel
{
    [Bindable] public var backToLoginButton:LinkButton;
    [Bindable] public var retrieveDataButton:Button;
    [Bindable] public var forgotWhatRadioGroup:RadioButtonGroup;
    [Bindable] public var emailAddress:TextInput;

    /**
     * Constructor
     */
    public function ForgotAccountInformationFormView()
    {
        super();
        this.addEventListener(FlexEvent.CREATION_COMPLETE, onComplete);
    }

    private function onComplete(event:FlexEvent): void
    {
        backToLoginButton.addEventListener(MouseEvent.CLICK, onBackToLoginClick);
        retrieveDataButton.addEventListener(MouseEvent.CLICK, onRetrieveDataClick);
    }

    private function onBackToLoginClick(event:MouseEvent):void
    {
        StateModel.getInstance().currentState = StateModel.VIEWLOGIN;        
    }

    private function onRetrieveDataClick(event:MouseEvent):void
    {
        if (emailAddress.text == null || emailAddress.text.length < 1)
        {
            Alert.show("Please enter the account's email address in order to recover username or password.", "Missing Email Address");
            return;
        }

        if (forgotWhatRadioGroup.selectedValue == AppConstants.RADIO_FORGOTPASSWORD)
        {
            AppServices.getInstance().resetPassword(emailAddress.text, new Responder(handleForgotPassword, handleFault));
        }
        else
        {
            AppServices.getInstance().remindOfUsername(emailAddress.text, new Responder(handleForgotUsername, handleFault));
        }
    }

    private function handleForgotUsername(obj:Object):void
    {
        trace("handleForgotUsername called with event: " + obj);
        Alert.show("Your username has been emailed to the email address on file for this account.", "Username Emailed");
    }

    private function handleForgotPassword(obj:Object):void
    {
        trace("handleForgotPassword called with event: " + obj);
        Alert.show("Your password has been reset and emailed to the email address on file for this account.", "Password Reset");
    }

    private function handleFault(obj:Object):void
    {
        Alert.show("An error occurred: " + obj.fault.faultString, "Error Occurred");
    }
}
}<commit_msg>changed forgot email text to make sense now that we can change passwords<commit_after>package org.arisgames.editor.forms
{
import flash.events.MouseEvent;
import mx.containers.Panel;
import mx.controls.Alert;
import mx.controls.Button;
import mx.controls.LinkButton;
import mx.controls.RadioButtonGroup;
import mx.controls.TextInput;
import mx.events.FlexEvent;
import mx.rpc.Responder;

import org.arisgames.editor.models.StateModel;
import org.arisgames.editor.services.AppServices;
import org.arisgames.editor.util.AppConstants;

public class ForgotAccountInformationFormView extends Panel
{
    [Bindable] public var backToLoginButton:LinkButton;
    [Bindable] public var retrieveDataButton:Button;
    [Bindable] public var forgotWhatRadioGroup:RadioButtonGroup;
    [Bindable] public var emailAddress:TextInput;

    /**
     * Constructor
     */
    public function ForgotAccountInformationFormView()
    {
        super();
        this.addEventListener(FlexEvent.CREATION_COMPLETE, onComplete);
    }

    private function onComplete(event:FlexEvent): void
    {
        backToLoginButton.addEventListener(MouseEvent.CLICK, onBackToLoginClick);
        retrieveDataButton.addEventListener(MouseEvent.CLICK, onRetrieveDataClick);
    }

    private function onBackToLoginClick(event:MouseEvent):void
    {
        StateModel.getInstance().currentState = StateModel.VIEWLOGIN;        
    }

    private function onRetrieveDataClick(event:MouseEvent):void
    {
        if (emailAddress.text == null || emailAddress.text.length < 1)
        {
            Alert.show("Please enter the account's email address in order to recover username or password.", "Missing Email Address");
            return;
        }

        if (forgotWhatRadioGroup.selectedValue == AppConstants.RADIO_FORGOTPASSWORD)
        {
            AppServices.getInstance().resetPassword(emailAddress.text, new Responder(handleForgotPassword, handleFault));
        }
        else
        {
            AppServices.getInstance().remindOfUsername(emailAddress.text, new Responder(handleForgotUsername, handleFault));
        }
    }

    private function handleForgotUsername(obj:Object):void
    {
        trace("handleForgotUsername called with event: " + obj);
        Alert.show("Your username has been emailed to the email address on file for this account.", "Username Emailed");
    }

    private function handleForgotPassword(obj:Object):void
    {
        trace("handleForgotPassword called with event: " + obj);
        Alert.show("An email has been sent with instructions to change your password.", "Password Reset");
    }

    private function handleFault(obj:Object):void
    {
        Alert.show("An error occurred: " + obj.fault.faultString, "Error Occurred");
    }
}
}
{'fraction_non_alphanumeric': 0.09006381039197812, 'fraction_numerical': 0.00036463081130355516, 'mean_word_length': 3.5716666666666668, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6723154', 'n_tokens_mistral': 1510, 'n_tokens_neox': 1456, 'n_words': 333}