Automatically reset a user''s password

I am developing a Jaber client using Smack and Wildfire.

Although I am quite familiar with the Smack API, Wildfire is completely unchartered territory for me.

I want a user to be able to request for a new password, if they forget the one they have.

In this scenario, the user clicks on a button to request a new password, and a new password is randomly generated and emailed to the user.

How do develop this feature?

I thinkign something along the lines of sending a IQ packet from the client to the server (but who will it be from?), the server detecting this request, then generating the random password (don’'t know how, yet), then encrypting this password, and updating the jiveuser table, and finally sending an email to the user with the new password.

I looked through the Spark src code, hoping to find somethign like this, but nada…

Any pointers are really appreciated.

Thanks,

Karan

Hi,

you may want to write a Wildfire Plugin, so it may be more a dev question. I assume that a web page would be a much better way to input the userid and the email address - but one should need to enter something more as this could allow everyone to abuse the web page.

The plugin itself could verify the userid and email address using the JIVEVCARD or JIVEUSER table and send an email with the new password. So you would use Wildfires code to send the email and to set the password - this will also make sure that you don’'t have problems with the database cache.

LG

Sorry about posting in the wrong forum.

Can an admin please move this thread to Wildfire Dev?

Thanks…


I’'ve been trying, but its not working.

When I send a message, I get back a error code 401.

I’'m guessing its because I cannot send message unless the user is logged in – is that right?

How do I make this happen?

TIA.

Here’'s the test code:

XMPPConnection.DEBUG_ENABLED = true;
connection = new XMPPConnection("sdl-guptak");
            Message m = new Message();
m.setTo("user1@resetpassword.sdl-guptak");
m.setBody("user1");
m.setFrom("user1@sdl-guptak");
            connection.sendPacket(m);

Here’'s my plugin code:

public class ResetPasswordPlugin implements Plugin, Component
{
    private static final String subdomain = "resetpassword";     private PluginManager pluginManager;
    private ComponentManager componentManager;     public ResetPasswordPlugin()
    {}
        public void initializePlugin(PluginManager manager, File pluginDirectory)
    {
        pluginManager = manager;         // Register new component
        componentManager = ComponentManagerFactory.getComponentManager();
        System.out.println("Initializing Reset Password Plugin");
                try
        {
            componentManager.addComponent(subdomain, this);
            System.out.println("Initialized Reset Password Plugin");
        }
        catch (Exception e)
        {
            componentManager.getLog().error(e);
        }
    }     public void destroyPlugin()
    {
        try
        {
            componentManager.removeComponent(subdomain);
            componentManager = null;
            pluginManager = null;
        }
        catch (Exception e)
        {
            componentManager.getLog().error(e);
        }
    }     public String getName()
    {
        return pluginManager.getName(this);
    }     public String getDescription()
    {
        return pluginManager.getDescription(this);
    }     public void initialize(JID jid, ComponentManager componentManager)
    {}     public void start()
    {}     public void shutdown()
    {}     public void processPacket(Packet packet)
    {
        System.out.println("Received Reset Password Packet");
        System.out.println(packet.toXML());
                if (packet instanceof Message)
        {
            Message message = (Message)packet;
            System.out.println("Reset password for: " + message.getBody());
        }
    } }

Ok, I figured this much out:

I cannot use connection.sendPacket(packet) unless I’'m logged in as a user.

After logging in the plugin code works.

So how to send a packet to the service, without logging in?