[ejabberd] user registration via HTTP

Liam ejabberd at networkimprov.net
Tue Jan 12 00:55:36 MSK 2010


I intend to provide the reg form and post it with XHR, so all i need is to
disable the captcha check below. However I'm not an erlang programmer --
suggestions?


form_new_post(Q, Host) ->
    case catch get_register_parameters(Q) of
    [Username, Password, Password, Id, Key] ->
        form_new_post(Username, Host, Password, Id, Key);
    [_Username, _Password, _Password2, Id, Key] ->
        ejabberd_captcha:check_captcha(Id, Key), %% This deletes the captcha
        {error, passwords_not_identical};
    _ ->
        {error, wrong_parameters}
    end.

get_register_parameters(Q) ->
    lists:map(
      fun(Key) ->
          {value, {_Key, Value}} = lists:keysearch(Key, 1, Q),
          Value
      end,
      ["username", "password", "password2", "id", "key"]).

form_new_post(Username, Host, Password, Id, Key) ->
    case ejabberd_captcha:check_captcha(Id, Key) of
    captcha_valid ->
        register_account(Username, Host, Password);
    captcha_non_valid ->
        {error, captcha_non_valid};
    captcha_not_found ->
        {error, captcha_non_valid}
    end.


On Mon, Jan 11, 2010 at 11:21 AM, Liam <ejabberd at networkimprov.net> wrote:

> Can I disable the use of captcha in mod_register_web? I set captcha_cmd to
> "", but the same failure occurs...
>
>
>
> On Sun, Jan 10, 2010 at 10:11 PM, Liam <ejabberd at networkimprov.net> wrote:
>
>> Decided to try mod_register_web. It's failing thus (man i can't get a
>> break here):
>>
>> ...
>> exception error: einval
>> in function open_port/2
>> called as open_port({spawn," 213599"},[stream,eof,binary])
>> in call from ejabberd_captcha:cmd/1
>> in call from ejabberd_captcha:create_image/1
>> ...
>>
>>
>>
>> On Mon, Jan 4, 2010 at 11:37 AM, Liam <ejabberd at networkimprov.net> wrote:
>>
>>> Can I restrict in-band registration to a single registrar account which
>>> the client must log into before creating a new user?
>>>
>>> And hey, Isn't web-based user sign-up really common? Why no HTTP
>>> interface to this in the main distribution?
>>>
>>>
>>>
>>> On Mon, Dec 21, 2009 at 8:39 PM, Liam <ejabberd at networkimprov.net>wrote:
>>>
>>>> I need to let new users register ejabberd accounts via the browser-based
>>>> xmpp client I'm coding.
>>>>
>>>> Some constraints:
>>>>
>>>> I can't use PHP (etc) to talk to ejabberd, as there is no server-side to
>>>> my app beyond ejabberd; it's 100% client-side javascript.
>>>>
>>>> I don't wish to allow in-band registration, as I only want users of my
>>>> browser app to have access to ejabberd.
>>>>
>>>> Thanks!
>>>>
>>>> Liam
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20100111/18b8faf9/attachment.html>


More information about the ejabberd mailing list