Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
Rinat #1
Member since May 2010 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: Register Account Information
Hi,

I wrote a client with the agsXMPP lib.

I used the RegisterAccount = true; and registration worked fine.

My problem is:

When I try to use the OnRegisterInformation event in order to update email data for example,
the registration works fine but the email ( and other data is not saved at all).

It is a problem for me because if I want to use the "Search" option for looking for rosters, and I config the search using email address it will not work for me cause the email not saved.

Is there something I miss?

Thanks,
Rinat
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
 This looks like a server problem to me. When the server advertises the email field then it should also store the email when you sent it correct.

Alex
Avatar
Alex #3
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
check also which information the search component of your server is using.
Some search components use the vcard fields, other use custom information which every user has to transmit to the search component.
If its vcard based then you should put the email address in the vcard after registration if the server doesn't do that automatically.

Alex
Avatar
Rinat #4
Member since May 2010 · 10 posts
Group memberships: Members
Show profile · Link to this post
Thanx for replying,

I'm using Openfire server.

I really do not think the problem is searching because it works fine when I update the email manually in DB.

The problem is when I get the mXmppClientConnection_OnRegisterInformation event and implement:

args.Register.Data.Remove();
args.Register.Username = un;
args.Register.Password = pswd;
args.Register.Email = "rin@domain.com";
args.Register.Name = "Rin Co";

the email and the name is not saved into db as I expect it to be.

Any idea?

Thenks,
Rinat
Avatar
Alex #5
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Please post the debug XML of a user registration. Then I can see which fields are provided by the server.

Alex
Avatar
Rinat #6
Member since May 2010 · 10 posts
Group memberships: Members
Show profile · Link to this post
Hi,

On event OnRegisterInformation I get the args.Register.Data like this:

<x xmlns="jabber:x:data" type="form">
<title>XMPP Client Registration</title>
<instructions>Please provide the following information</instructions>
<field type="hidden" var="FORM_TYPE"><value>jabber:iq:register</value></field>
<field type="text-single" label="Username" var="username"><required /></field>
<field type="text-single" label="Full name" var="name" />
<field type="text-single" label="Email" var="email" />
<field type="text-private" label="Password" var="password"><required /></field></x>}

Then, my code is:

args.Register.Data.Remove();
args.Register.Username = un;
args.Register.Password = pswd;
args.Register.Email = "rin@domain.com";
args.Register.Name = "Rin Co";

Is that what you mean?

Rinat
Avatar
Alex #7
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Yes, but this is not the complete stanza.
The xdata form has an email value, but you remove the xdata form and use old jabber style tags instead.

Alex
Avatar
Rinat #8
Member since May 2010 · 10 posts
Group memberships: Members
Show profile · Link to this post
Thanks,

So... what do you suggest?
what can I do?

rinat
Avatar
Alex #9
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
See XEP-0077: In-Band Registration

The server can offer either

old jabber style registration:
  1. <iq type='result' id='reg1'>
  2.  <query xmlns='jabber:iq:register'>
  3.     <instructions>
  4.       Choose a username and password for use with this service.
  5.       Please also provide your email address.
  6.     </instructions>
  7.     <username/>
  8.     <password/>
  9.     <email/>
  10.  </query>
  11. </iq>

new xdata registration
  1. <iq type='result'
  2.     from='contests.shakespeare.lit'
  3.     to='juliet@capulet.com/balcony'
  4.     id='reg3'>
  5.  <query xmlns='jabber:iq:register'>
  6.     <instructions>
  7.       Use the enclosed form to register. If your Jabber client does not
  8.       support Data Forms, visit http://www.shakespeare.lit/contests.php
  9.     </instructions>
  10.     <x xmlns='jabber:x:data' type='form'>
  11.       <title>Contest Registration</title>
  12.       <instructions>
  13.         Please provide the following information
  14.         to sign up for our special contests!
  15.       </instructions>
  16.       <field type='hidden' var='FORM_TYPE'>
  17.         <value>jabber:iq:register</value>
  18.       </field>
  19.       <field type='text-single' label='Given Name' var='first'>
  20.         <required/>
  21.       </field>
  22.       <field type='text-single' label='Family Name' var='last'>
  23.         <required/>
  24.       </field>
  25.       <field type='text-single' label='Email Address' var='email'>
  26.         <required/>
  27.       </field>
  28.       <field type='list-single' label='Gender' var='x-gender'>
  29.         <option label='Male'><value>M</value></option>
  30.         <option label='Female'><value>F</value></option>
  31.       </field>
  32.     </x>
  33.  </query>
  34. </iq>

or both
  1. <iq type='result'
  2.     from='contests.shakespeare.lit'
  3.     to='juliet@capulet.com/balcony'
  4.     id='reg3'>
  5.  <query xmlns='jabber:iq:register'>
  6.     <!-- old jabber style stuff -->
  7.     <instructions>
  8.       Choose a username and password for use with this service.
  9.       Please also provide your email address.
  10.     </instructions>
  11.     <username/>
  12.     <password/>
  13.     <email/>   
  14.     <!-- xdata form -->
  15.     <x xmlns='jabber:x:data' type='form'>
  16.       <title>Contest Registration</title>
  17.       <instructions>
  18.         Please provide the following information
  19.         to sign up for our special contests!
  20.       </instructions>
  21.       <field type='hidden' var='FORM_TYPE'>
  22.         <value>jabber:iq:register</value>
  23.       </field>
  24.       <field type='text-single' label='Given Name' var='first'>
  25.         <required/>
  26.       </field>
  27.       <field type='text-single' label='Family Name' var='last'>
  28.         <required/>
  29.       </field>
  30.       <field type='text-single' label='Email Address' var='email'>
  31.         <required/>
  32.       </field>
  33.       <field type='list-single' label='Gender' var='x-gender'>
  34.         <option label='Male'><value>M</value></option>
  35.         <option label='Female'><value>F</value></option>
  36.       </field>
  37.     </x>
  38.  </query>
  39. </iq>

IIRC Openfire offer both, and you are currently using old jabber style registration, so please try the xdata registration which should store the email address. If it doesn't then contact the Openfire developers. When you use xdata registration then make sure that you remove the old jabber style fields. Because most servers are first looking for them in the response and then in the xdata form.

Alex
Avatar
Rinat #10
Member since May 2010 · 10 posts
Group memberships: Members
Show profile · Link to this post
Subject: Thanks for replying
Before contact to Openfire developers I must ask again.

On  OnRegisterInformation event I get the following iq :

<query xmlns="jabber:iq:register">

    <username />
    <password />
    <email />
    <name />

    <x xmlns="jabber:x:data" type="form">
        <title>XMPP Client Registration</title>
        <instructions>Please provide the following information</instructions>
        <field type="hidden" var="FORM_TYPE">
            <value>jabber:iq:register</value>
        </field>
        <field type="text-single" label="Username" var="username">
            <required />
        </field>
       
        <field type="text-single" label="Full name" var="name" />
        <field type="text-single" label="Email" var="email" />
       

        <field type="text-private" label="Password" var="password">
            <required />
        </field>
    </x>
</query>

Red lines represent the old method which I remove from the answer.

Notice the blue lines: email and name are not required at all.

I wrote the code below, to prepare the form as requested:
1. I have chnage the type to "Submit"
2. I didn't remove the Data tag.
3. I remove the old fields (username etc.)
4. I remove all required tags and instead I set valuse as I wanted ( also I did it to the email and name which have not been required).
5. I remove the title and instruction tags.

    Data xData = args.Register.Data;
            args.Register.RemoveTag("username");
            args.Register.RemoveTag("password");
            args.Register.RemoveTag("email");
            args.Register.RemoveTag("name");

            args.Register.RemoveTag("required");

            xData.Type = XDataFormType.submit;
            xData.GetField("username").SetValue(un);
            xData.GetField("password").SetValue(pswd);
            xData.GetField("email").SetValue(Globals.Email);
            xData.GetField("name").SetValue(Globals.FirstName + " " + Globals.LastName);

            xData.GetField("username").RemoveTag("required");
            xData.GetField("password").RemoveTag("required");
            xData.GetField("email").RemoveTag("required");
            xData.GetField("name").RemoveTag("required");

            xData.RemoveTag("title");
            xData.RemoveTag("instructions");

So I got the following answer as bellow:

<query xmlns="jabber:iq:register">
    <x xmlns="jabber:x:data" type="submit">
        <field type="hidden" var="FORM_TYPE">
            <value>jabber:iq:register</value>
        </field>
        <field type="text-single" label="Username" var="username">
            <value>miki</value>
        </field>
        <field type="text-single" label="Full name" var="name">
            <value>miki mouse</value>
        </field>
        <field type="text-single" label="Email" var="email">
            <value>miki@disney.com</value>
        </field>
        <field type="text-private" label="Password" var="password">
            <value>1234</value>
        </field>
    </x>
</query>

and I was so sorry to find out that it didn't work.
the Users table in the DataTable still have null field for the user I just register. Poor Miki  :-(

Any Idea again?

Thanks,
Rinat
Avatar
Alex #11
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
the code and your xml looks fine.
Did the registration with xdata work? If yes then its either an Openfire bug that they don't store the email, or its just not implemented.
But it makes no sense to me to provide an email field and ignore it when the user sets a value.

Alex
Avatar
Rinat #12
Member since May 2010 · 10 posts
Group memberships: Members
Show profile · Link to this post
Thanks.

I'll contact them.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS