indexing description: "User reset password use case." author: "Peter Wyss " date: "$Date$" revision: "$Revision$" class USER_RESET_PASSWORD inherit USE_CASE O_USER_CONSTANTS O_CONFIG_CONSTANTS create make feature -- Access namespace: STRING is -- Namespace of this use case. once Result := user_namespace end type: STRING is -- Message type of this use case. once Result := user_reset_password_type end feature -- Basic operation start (a_msg: O_MESSAGE) is -- Start the use case by a_msg. local l_fwd: O_GENERIC_MESSAGE do -- send message to storage node create l_fwd.make (a_msg.namespace, a_msg.type) l_fwd.set_arguments (a_msg.arguments) l_fwd.set_reply_handler (agent process_storage_reply (?, a_msg)) node.send_message_node (l_fwd, "storage1") end feature {NONE} -- Callbacks process_storage_reply (a_msg, a_orig_msg: O_MESSAGE) is -- Process reply from storage node. require a_msg_not_void: a_msg /= Void a_orig_msg_not_void: a_orig_msg /= Void local l_reset_reply: O_USER_RESET_PASSWORD_REPLY_MESSAGE l_mail: O_MAIL_MESSAGE l_conf: O_GENERIC_MESSAGE l_status: O_GENERAL_STATUS_MESSAGE do -- do we have a reset reply? l_reset_reply ?= a_msg if l_reset_reply /= Void then -- send an email create l_mail.make (l_reset_reply.email, "Origo", "[Origo] Password reset", "Your origo password has been set to "+l_reset_reply.password) node.send_message_node (l_mail, "mail1") -- also regeneration svn configuration create l_conf.make (config_namespace, config_svn_type) l_conf.set_reply_handler (agent forward_to_node (?, "config1")) node.send_message_node (l_conf, "storage1") -- also regenerate ftp configuration create l_conf.make (config_namespace, config_ftp_type) l_conf.set_reply_handler (agent forward_to_node (?, "config1")) node.send_message_node (l_conf, "storage1") create l_conf.make (config_namespace, config_command_type) l_conf.add_argument ("pureftp", "/usr/bin/pure-pw mkdb") node.send_message_node (l_conf, "config1") -- send status ok create l_status.make (True, Void) node.send_message_reply (l_status, a_orig_msg) else -- just forward the message to the original sender node.send_message_reply (a_msg, a_orig_msg) end end end