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 TypeMethodDescriptionvoid
abort()
Abort this view.void
clean()
Close resources if any that are left opened.void
close()
Close this view.void
This will be invoked by theApplication
just before making the component of this view visible.protected void
Override this if you want to do something before the View comes up on the screen.void
setCustomTag
(String customTag) Set a custom tag that will be passed to the quick senders as an additional parameter.void
setResendTimeout
(int resendTimeout) Set "resend" timeout.void
setSenderTimeoutEmail
(int senderTimeoutEmail) Set "Email sender" timeout.void
setSenderTimeoutSMS
(int senderTimeoutSMS) Set "SMS sender" timeout.void
setTemplateName
(String templateName) Set the template name to be used for constructing the OTP message.void
setUserTimeout
(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, skipFirstFocus
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.storedobject.vaadin.ClickHandler
clicked, doubleClicked, onComponentEvent, rightClicked
Methods 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, warning
Methods 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:View
This will be invoked by theApplication
just 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 ofHasSize
so 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:
decorateComponent
in classView
-
execute
Description copied from class:View
Override 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:View
Close 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:
clean
in interfaceExecutableView
- Overrides:
clean
in classView
-
abort
public void abort()Description copied from class:View
Abort this view. Default implementation sets an "abort flag" and closes the view.- Specified by:
abort
in interfaceExecutableView
- Overrides:
abort
in classView
-
close
public void close()Description copied from class:View
Close this view.- Specified by:
close
in interfaceExecutableView
- Overrides:
close
in 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.
-