99 lines
3.0 KiB
Java
99 lines
3.0 KiB
Java
/*
|
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
|
* (the "License"); you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
|
*
|
|
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
|
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
|
* language governing rights and limitations under the License.
|
|
*
|
|
* The Original Code is the Venice Web Community System.
|
|
*
|
|
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
|
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
|
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
*/
|
|
package com.silverwrist.venice.servlets.format;
|
|
|
|
import com.silverwrist.venice.ValidationException;
|
|
import com.silverwrist.venice.core.IDUtils;
|
|
|
|
public class VerifyEmailDialog extends ContentDialog
|
|
{
|
|
int confirm_num = 0;
|
|
|
|
public VerifyEmailDialog()
|
|
{
|
|
super("Verify E-mail Address",null,"verifyform","account");
|
|
setInstructions("Check your e-mail, then enter the confirmation number that was e-mailed to you "
|
|
+ "in the field below. Once you do so, your account will be fully validated. "
|
|
+ "If you have not received your confirmation, click on the 'Send Again' button "
|
|
+ "below.");
|
|
setHiddenField("cmd","V");
|
|
setHiddenField("tgt","");
|
|
addFormField(new CDTextFormField("num","Confirmation number",null,false,7,7));
|
|
addCommandButton(new CDImageButton("ok","bn_ok.gif","OK",80,24));
|
|
addCommandButton(new CDImageButton("again","bn_send_again.gif","Send Again",80,24));
|
|
addCommandButton(new CDImageButton("cancel","bn_cancel.gif","Cancel",80,24));
|
|
|
|
} // end constructor
|
|
|
|
protected VerifyEmailDialog(VerifyEmailDialog other)
|
|
{
|
|
super(other);
|
|
|
|
} // end constructor
|
|
|
|
protected void validateWholeForm() throws ValidationException
|
|
{
|
|
try
|
|
{ // convert to a number and check its range
|
|
int num = Integer.parseInt(getFieldValue("num"));
|
|
|
|
if (!IDUtils.isValidConfirmationNumber(num))
|
|
throw new ValidationException("The value you have entered is not a valid confirmation number.");
|
|
|
|
confirm_num = num; // save off for later
|
|
|
|
} // end try
|
|
catch (NumberFormatException e)
|
|
{ // conversion error!
|
|
throw new ValidationException("The value you have entered is not a valid number.");
|
|
|
|
} // end catch
|
|
|
|
} // end validateWholeForm
|
|
|
|
public void setTarget(String target)
|
|
{
|
|
setHiddenField("tgt",target);
|
|
|
|
} // end setTarget
|
|
|
|
public int getConfirmationNumber()
|
|
{
|
|
return confirm_num;
|
|
|
|
} // end getConfirmationNumber
|
|
|
|
public void resetOnError(String message)
|
|
{
|
|
setErrorMessage(message);
|
|
setFieldValue("num",null);
|
|
|
|
} // end resetOnError
|
|
|
|
public Object clone()
|
|
{
|
|
return new VerifyEmailDialog(this);
|
|
|
|
} // end clone
|
|
|
|
} // end class VerifyEmailDialog
|
|
|
|
|
|
|
|
|