Package com.storedobject.ui
Class VerifyOTP
java.lang.Object
com.storedobject.vaadin.View
com.storedobject.ui.VerifyOTP
- All Implemented Interfaces:
ClickHandler,CloseableView,ExecutableView,ValueChangeHandler,com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<? extends com.vaadin.flow.component.Component>>,com.vaadin.flow.component.HasValue.ValueChangeListener,Serializable,Runnable,EventListener
Verify OTP.
- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.storedobject.vaadin.ClickHandler
ClickHandler.ModifiedClickEvent<C extends com.vaadin.flow.component.Component> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Abort this view.voidclean()Close resources if any that are left opened.voidclose()Close this view.voidThis will be invoked by theApplicationjust before making the component of this view visible.protected voidOverride this if you want to do something before the View comes up on the screen.voidsetCustomTag(String customTag) Set a custom tag that will be passed to the quick senders as an additional parameter.voidsetResendTimeout(int resendTimeout) Set "resend" timeout.voidsetSenderTimeoutEmail(int senderTimeoutEmail) Set "Email sender" timeout.voidsetSenderTimeoutSMS(int senderTimeoutSMS) Set "SMS sender" timeout.voidsetTemplateName(String templateName) Set the template name to be used for constructing the OTP message.voidsetUserTimeout(int userTimeout) Set "user response" timeout.Methods inherited from class com.storedobject.vaadin.View
aborted, addClosedListener, addOpenedListener, createCloseableView, createWindow, execute, execute, executing, focus, focus, focusAny, getApplication, getCaption, getComponent, getContent, getCreatedBy, getEmbeddedView, getMenuItem, getMenuItem, getView, initUI, invoke, isFullScreen, isScrollable, isWindowMode, select, setCaption, setComponent, setCreatedBy, setDefaultPadding, setEmbeddedView, setFirstFocus, setFullScreen, setScrollable, setWindowMode, skipFirstFocusMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.storedobject.vaadin.ClickHandler
clicked, doubleClicked, onComponentEvent, rightClickedMethods inherited from interface com.storedobject.vaadin.ExecutableView
clearAlerts, clicked, createMenuItem, error, getMenuIconName, getView, isCloseable, isHomeView, log, log, message, returnedFrom, run, setClickable, speak, trackValueChange, tray, valueChanged, warningMethods inherited from interface com.storedobject.vaadin.ValueChangeHandler
valueChanged
-
Constructor Details
-
VerifyOTP
public VerifyOTP(String phone, String email, Runnable verified, Runnable cancelled, Runnable errorWhileSending) Constructor.- Parameters:
phone- Mobile phone number. If null, SMS OTP will not be verified.email- Email. If null, email OTP will not be verified.verified- Runnable to be invoked if verified successfully. (Can not benull).cancelled- Runnable to be invoked if verification is cancelled by the user. (Can not benull).errorWhileSending- Runnable to be invoked if technical issue with sending SMS/emails. (Can not benull).
-
VerifyOTP
public VerifyOTP(boolean singleOTP, String phone, String email, Runnable verified, Runnable cancelled, Runnable errorWhileSending) Constructor.- Parameters:
singleOTP- Whether to send the same OTP to both phone and email or not.phone- Mobile phone number. If null, SMS OTP will not be verified.email- Email. If null, email OTP will not be verified.verified- Runnable to be invoked if verified successfully. (Can not benull).cancelled- Runnable to be invoked if verification is cancelled by the user. (Can not benull).errorWhileSending- Runnable to be invoked if technical issue with sending SMS/emails. (Can not benull).
-
-
Method Details
-
decorateComponent
public void decorateComponent()Description copied from class:ViewThis will be invoked by theApplicationjust before making the component of this view visible. The default implementation does the following to the component:If it is a
Dialog, just returns without making any changes.Will set the size to 'full' by invoking
HasSize.setSizeFull()if it is an instance ofHasSizeso that it covers the entire content area.Padding will be set to 5px (unless changed via
View.setDefaultPadding(int)) and box-sizing to border-box. So, if you want to fill the component to the entire content area, you will have to override this method and set the padding to 0px.If the component is an instance of
Div, its "display" style will be set to "flex" and its "flex-direction" will be set to "column".- Overrides:
decorateComponentin classView
-
execute
Description copied from class:ViewOverride this if you want to do something before the View comes up on the screen. Call super.execute(parent, doNotLock) to make the View appear on the screen. Parent view is automatically selected when this view closes. -
clean
public void clean()Description copied from class:ViewClose resources if any that are left opened. This method is invoked when the view is removed from theApplication. The default implementation does nothing.- Specified by:
cleanin interfaceExecutableView- Overrides:
cleanin classView
-
abort
public void abort()Description copied from class:ViewAbort this view. Default implementation sets an "abort flag" and closes the view.- Specified by:
abortin interfaceExecutableView- Overrides:
abortin classView
-
close
public void close()Description copied from class:ViewClose this view.- Specified by:
closein interfaceExecutableView- Overrides:
closein classView
-
setCustomTag
Set a custom tag that will be passed to the quick senders as an additional parameter.- Parameters:
customTag- Custom tag to be set.
-
setTemplateName
Set the template name to be used for constructing the OTP message. If no template name is set, a default message is constructed, and it will look like:"Your OTP is ABC:12345678"
- Parameters:
templateName- Name of the template to use.
-
setResendTimeout
public void setResendTimeout(int resendTimeout) Set "resend" timeout.- Parameters:
resendTimeout- Timeout in seconds.
-
setSenderTimeoutSMS
public void setSenderTimeoutSMS(int senderTimeoutSMS) Set "SMS sender" timeout.- Parameters:
senderTimeoutSMS- Timeout in seconds.
-
setSenderTimeoutEmail
public void setSenderTimeoutEmail(int senderTimeoutEmail) Set "Email sender" timeout.- Parameters:
senderTimeoutEmail- Timeout in seconds.
-
setUserTimeout
public void setUserTimeout(int userTimeout) Set "user response" timeout.- Parameters:
userTimeout- Timeout in seconds.
-