Msform.AuthPasswordReset (msapp_mcp v0.1.0)
Form/API data used for the user self-service password reset process.
Summary
Functions
Removes a processing override from the active overrides list.
Retrieves the textual information (label
, label_link
, and info
)
field values from the Form Configuration for the identified component.
See Msform.AuthPasswordReset.Actions.process_reset_attempt/1
.
See Msform.AuthPasswordReset.Actions.process_reset_finished/1
.
Adds a processing override to the active overrides list.
Sets the state of MscmpSystForms.WebComponents.msvalidated_button/1
components.
Updates the display form data with new values.
See Msform.AuthPasswordReset.Actions.validate_form_data/2
.
Types
Functions
finish_processing_override(socket_or_assigns, override)
@spec finish_processing_override( MscmpSystForms.Types.socket_or_assigns(), MscmpSystForms.Types.processing_override_name() ) :: MscmpSystForms.Types.socket_or_assigns()
Removes a processing override from the active overrides list.
Once an active operation previously added to the process overrides list has completed its processing, this function is used to remove it from the list so that any user interface components that are watching for the operation to be active can resume their normal behavior.
Parameters
socket_or_assigns
- the socket or assigns for the current view.override
- the name of the processing override to remove from the active process overrides list.
get_component_info(component_id)
@spec get_component_info( %{form_id: MscmpSystForms.Types.form_id()} | %{binding_id: MscmpSystForms.Types.binding_id()} ) :: MscmpSystForms.Types.ComponentInfo.t() | nil
Retrieves the textual information (label
, label_link
, and info
)
field values from the Form Configuration for the identified component.
This is a convenience function which accepts either a form_id
value or
a binding_id
value and returns the textual information for the
component if found by the passed identifier.
Parameters
component_id
- this value is either theform_id
orbinding_id
that is associated with the component for which textual information is being retrieved.
process_reset_attempt(socket)
See Msform.AuthPasswordReset.Actions.process_reset_attempt/1
.
process_reset_finished(socket)
See Msform.AuthPasswordReset.Actions.process_reset_finished/1
.
start_processing_override(socket_or_assigns, override)
@spec start_processing_override( MscmpSystForms.Types.socket_or_assigns(), MscmpSystForms.Types.processing_override_name() ) :: MscmpSystForms.Types.socket_or_assigns()
Adds a processing override to the active overrides list.
Some user interface components are configured to change their presentation and
interactivity when certain, possibly long running, processes are underway.
This function adds the value of the override
parameter to the active
processes list allowing components interest in that processing state to
respond accordingly.
Parameters
socket_or_assigns
- the socket or assigns for the current view.override
- the name of the processing override to activate. This value will be an atom and will be form implementation specific.
update_button_state(socket_or_assigns, form_id, button_state)
@spec update_button_state( MscmpSystForms.Types.socket_or_assigns(), MscmpSystForms.Types.form_id(), MscmpSystForms.Types.msvalidated_button_states() ) :: MscmpSystForms.Types.socket_or_assigns()
Sets the state of MscmpSystForms.WebComponents.msvalidated_button/1
components.
Validated buttons exist in one of three states defined by
MscmpSystForms.Types.msvalidated_button_states/0
. This function will
set the state of the validated button identified by the form_id
parameters to the state identified by the button_state
parameters.
Parameters
socket_or_assigns
- the socket or assigns for the current view.form_id
- the identifier of the component to update. SeeMscmpSystForms.get_form_config/0
for more about form configuration attributes.button_state
- the state to which the validated button component should be set. Any value defined by theMscmpSystForms.Types.msvalidated_button_states/0
type is valid for this purpose.
update_display_data(socket_or_assigns, display_data, opts \\ [])
@spec update_display_data( MscmpSystForms.Types.socket_or_assigns(), Ecto.Changeset.t() | Phoenix.HTML.Form.t(), Keyword.t() ) :: MscmpSystForms.Types.socket_or_assigns()
Updates the display form data with new values.
The display data of the form, which represents the form's backing data
after the application of effective user permissions to purge values that
the user is not entitled to see, is set using this function. The data is
stored in the view's assigns as a t:Phoenix.HTML.Form.t/0' value which is then passed to the view for rendering. ## Parameters *
socket_or_assigns- the socket or assigns for the current view. *
display_data- this option contains either the new display data to set and with which to update the form or indicates the kind of data validation to perform on the assigns stored data (
msrd_original_data&
msrd_current_data; see
MscmpSystForms.init_assigns/8for more). One method for setting the display data is to pass this option to the function using actual data. This data can take the form of either a
t:Ecto.Changeset.t/0value or a
t:Phoenix.HTML.Form.t/0value. If a Changeset is passed, the function will automatically process it into a
t:Phoenix.HTML.Form.t/0struct, applying the permissions currently set in the
msrd_user_permsStandard Assigns Attribute to filter the data. If the value to be passed in this option is a
t:Phoenix.HTML.Form.t/0value, the struct should have been generated using
MscmpSystForms.to_form/3so that the user data visibility permissions will have been allied. The second method is to pass
display_dataas a value referencing a display data validation type (
t:MscmpSystForms.Types.data_validation_types/0). When this method is used, the values of the
msrd_current_dataand
msrd_original_dataare validated using the standard validation functions (
c:MscmpSystForms.validate_save/2and
c:MscmpSystForms.validate_post/2) and then processed into a
t:Phoenix.HTML.Form.t/0value to save as the new
msrd_display_datavalue. Either of the validation types will result in the application of user data visibility permissions per the
msrd_user_permsStandard Assigns Attribute. *
opts- this function defines some optionally required parameters which are dependent on the
display_dataparameter. When the
display_datavalue is passed as a
t:MscmpSystForms.Types.data_validation_types/0allowed value the following are required: *
original_data- a struct of values representing the starting data initialized on initial form loading and absent any changes the user may have made and not yet committed to the database. This value should be available in the standard assigns for
MscmpSystFormsbased forms. *
current_data- a map of values representing the current data backing the form. This data is complete (unfiltered by user data related permissions) and includes any edits made by the user and not yet committed to the database. This value is available in the standard assigns for
MscmpSystForms` based forms
validate_form_data(socket, form_data)
See Msform.AuthPasswordReset.Actions.validate_form_data/2
.