mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Update image key, some scripts generate their own random key
This commit is contained in:
parent
4ad4a3bf24
commit
9087e72f0e
@ -77,6 +77,11 @@ mk_ocr_field(Lang, CID, Type) ->
|
|||||||
[_, F] = captcha_form:encode([{ocr, <<>>}], Lang, [ocr]),
|
[_, F] = captcha_form:encode([{ocr, <<>>}], Lang, [ocr]),
|
||||||
xmpp:set_els(F, [#media{uri = [URI]}]).
|
xmpp:set_els(F, [#media{uri = [URI]}]).
|
||||||
|
|
||||||
|
update_captcha_key(_Id, Key, Key) ->
|
||||||
|
ok;
|
||||||
|
update_captcha_key(Id, _Key, Key2) ->
|
||||||
|
true = ets:update_element(captcha, Id, [{4, Key2}]).
|
||||||
|
|
||||||
-spec create_captcha(binary(), jid(), jid(),
|
-spec create_captcha(binary(), jid(), jid(),
|
||||||
binary(), any(),
|
binary(), any(),
|
||||||
callback() | term()) -> {error, image_error()} |
|
callback() | term()) -> {error, image_error()} |
|
||||||
@ -243,7 +248,8 @@ process(_Handlers,
|
|||||||
case lookup_captcha(Id) of
|
case lookup_captcha(Id) of
|
||||||
{ok, #captcha{key = Key}} ->
|
{ok, #captcha{key = Key}} ->
|
||||||
case create_image(Addr, Key) of
|
case create_image(Addr, Key) of
|
||||||
{ok, Type, _, Img} ->
|
{ok, Type, Key2, Img} ->
|
||||||
|
update_captcha_key(Id, Key, Key2),
|
||||||
{200,
|
{200,
|
||||||
[{<<"Content-Type">>, Type},
|
[{<<"Content-Type">>, Type},
|
||||||
{<<"Cache-Control">>, <<"no-cache">>},
|
{<<"Cache-Control">>, <<"no-cache">>},
|
||||||
|
Loading…
Reference in New Issue
Block a user